Bug 44574 - ProxyIOBufferSize documement wrong (2.2)
Summary: ProxyIOBufferSize documement wrong (2.2)
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.2-HEAD
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2008-03-11 03:33 UTC by Matthieu Estrade
Modified: 2013-04-27 18:32 UTC (History)
1 user (show)



Attachments
Patch for 2.0.63 (509 bytes, patch)
2008-03-11 03:34 UTC, Matthieu Estrade
Details | Diff
Patch for 2.2.8 (558 bytes, patch)
2008-03-11 03:34 UTC, Matthieu Estrade
Details | Diff
Remove limit ProxyIOBufferSize (trunk) (1.58 KB, patch)
2008-03-20 21:56 UTC, Takashi Sato
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthieu Estrade 2008-03-11 03:33:22 UTC
Hello,

I've found something strange in the mod_proxy (httpd 2.0.63 and 2.2.8) setup:
The following directive says:

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxyiobuffersize

The |ProxyIOBufferSize| directive adjusts the size of the internal buffer, which is used as a scratchpad for the data between input and output. The size must be less or equal |8192|.


LESS or EQUAL 8192...

And the code in mod_proxy.c is:

long s = atol(arg);

psf->io_buffer_size = ((s > AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
psf->io_buffer_size_set = 1;


should be

psf->io_buffer_size = ((s < AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);


It's the same in 2.2.x:

else if (!strcasecmp(key, "iobuffersize")) {
       long s = atol(val);
       worker->io_buffer_size = ((s > AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
       worker->io_buffer_size_set = 1;
}

I actually need this directive to work better with some stream data. Can somebody confirm the modification must be done in the code and not in the documentation ?
Comment 1 Matthieu Estrade 2008-03-11 03:34:04 UTC
Created attachment 21649 [details]
Patch for 2.0.63
Comment 2 Matthieu Estrade 2008-03-11 03:34:30 UTC
Created attachment 21650 [details]
Patch for 2.2.8
Comment 3 Takashi Sato 2008-03-14 08:46:00 UTC
In 2.2.x both proxy_server_conf's and proxy_worker's io_buffer_size need to be fixed, don't they?


--- mod_proxy.c.orig
+++ mod_proxy.c
@@ -148,7 +148,7 @@
     }
     else if (!strcasecmp(key, "iobuffersize")) {
         long s = atol(val);
-        worker->io_buffer_size = ((s > AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
+        worker->io_buffer_size = ((s < AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
         worker->io_buffer_size_set = 1;
     }
     else if (!strcasecmp(key, "receivebuffersize")) {
@@ -1467,7 +1467,7 @@
     ap_get_module_config(parms->server->module_config, &proxy_module);
     long s = atol(arg);
 
-    psf->io_buffer_size = ((s > AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
+    psf->io_buffer_size = ((s < AP_IOBUFSIZE) ? s : AP_IOBUFSIZE);
     psf->io_buffer_size_set = 1;
     return NULL;
 }
Comment 4 Takashi Sato 2008-03-20 20:51:43 UTC
Does Limitting ProxyIOBufferSize make sense?
Comment 5 Takashi Sato 2008-03-20 21:32:45 UTC
io_buffer_size is used by mod_proxy_ajp, mod_proxy_http and mod_proxy_ftp.

mod_proxy_http and mod_proxy_ftp just uses io_buffer_size directly.
mod_proxy_http.c line 1637:

rv = ap_get_brigade(rp->input_filters, bb,
    AP_MODE_READBYTES, mode,
    conf->io_buffer_size);


Unlike them, mod_proxy_ajp has own limits.
mod_proxy_ajp.c line 171:

apr_size_t maxsize = AJP_MSG_BUFFER_SZ;

if (psf->io_buffer_size_set)
   maxsize = psf->io_buffer_size;
if (maxsize > AJP_MAX_BUFFER_SZ)
   maxsize = AJP_MAX_BUFFER_SZ;
else if (maxsize < AJP_MSG_BUFFER_SZ)
   maxsize = AJP_MSG_BUFFER_SZ;
maxsize = APR_ALIGN(maxsize, 1024);

ajp.h line 134:

#define AJP_MSG_BUFFER_SZ           8192
#define AJP_MAX_BUFFER_SZ           65536
Comment 6 Takashi Sato 2008-03-20 21:56:21 UTC
Created attachment 21697 [details]
Remove limit ProxyIOBufferSize (trunk)

There's no reason limitting ProxyIOBufferSize in mod_proxy.
If needed, protocol providers should.
Comment 7 Takashi Sato 2013-04-16 04:21:01 UTC
2.2 doc still says "The size must be less or equal 8192."
The 2.2 code says ProxyIOBufferSize must be greater than or equal to 8192.
2.4 doc says "The size must be at least 512."

2.2 doc should be wrong.
Comment 8 Takashi Sato 2013-04-16 04:43:21 UTC
found similar discussion:
http://www.mail-archive.com/dev@httpd.apache.org/msg41850.html
Comment 9 Graham Leggett 2013-04-27 18:32:35 UTC
Docs updated in trunk: http://svn.apache.org/r1476652
In v2.4: http://svn.apache.org/r1476653
In v2.2: http://svn.apache.org/r1476655