httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Stano <stan...@blackhole.sk>
Subject Re: apache 2.2 mod_proxy_http disable buffering
Date Mon, 03 Dec 2007 17:52:52 GMT
Ruediger Pluem wrote:
> 
> On 12/03/2007 05:54 PM, Pavel Stano wrote:
>> Plüm wrote:
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Pavel Stano 
>>>> Gesendet: Montag, 3. Dezember 2007 09:53
>>>> An: dev@httpd.apache.org
>>>> Betreff: apache 2.2 mod_proxy_http disable buffering
>>>>
>>>>
>>>> hello,
>>>>
>>>> it is possible to disable buffering in mod_proxy_http ?
>>>> or something like flush after each received data (i want this 
>>> At least with 2.2.6 (possibly earlier 2.2.x versions) it has autoflushing.
>>> This means once there is no more data available for reading in the response
>>> stream from the backend it flushes what it got so far. So if your php script
>>> on the backend generates its response in blocks with pause times between them
>>> each of them will be send to the client immediately.
>>>
>>> Regards
>>>
>>> Rüdiger
>> i have 2.2.6, but it dont work, proxy send me data after end of request
>>
>> i have very simple php script (or .cgi, i try it too)
>> <?php
>> echo 'A';
>> echo 'B';
>> sleep(5);
>> echo 'C';
>> ?>
>> php buffering is configured ok, when i connect with telnet to backend
>> server a request a.php, it work as expected
>> it show immedietaly headers and AB and after 5 second it show C and
>> close connection
>>
>> when i connect to reverse proxy and request a.php, 5 second is silent
>> and after that it send me response
>>
>> maybe a bug in mod_proxy_http ? (or not a bug but broken feature :))
>>
>> here is strace from that proxy
>>
>> ... we write request to backend
>> 22112 17:06:47.916530 writev(12, [{"GET /a.php HTTP/1.1\r\n", 21},
>> {"Host: rtfm.home\r\n", 17}, {"Max-Forwards: 10\r\n", 18},
>> {"X-Forwarded-For: 127.0.0.1\r\n", 28}, {"X-Forwarded-Host:
>> rtfm.home\r\n", 29}, {"X-Forwarded-Server: rtfm.home\r\n", 31},
>> {"Connection: Keep-Alive\r\n", 24}, {"\r\n", 2}], 8) = 170
>>
>> ... we got answer (headers and AB)
>> 22112 17:06:47.920203 read(12, "HTTP/1.1 200 OK\r\nDate: Mon, 03 D"...,
>> 8000) = 156
>> 22112 17:06:47.920418 poll( <unfinished ...>
>>
>> ... here we want send first data to client, but we just wait for data
>> >from backend
>>
>> ... after 5 seconds we got C and send everything to client
>> 22112 17:06:52.920176 <... poll resumed> [{fd=12, events=POLLIN,
>> revents=POLLIN}], 1, 60000) = 1
>> 22112 17:06:52.920232 read(12, "1\r\nC\r\n3\r\n \n\n\r\n0\r\n\r\n",
>> 8000) = 19
>> 22112 17:06:52.920315 close(12)         = 0
>> 22112 17:06:52.920414 writev(11, [{"HTTP/1.1 200 OK\r\nDate: Mon, 03
>> D"..., 139}, {"A", 1}, {"B", 1}, {"C", 1}, {" \n\n", 3}], 5) = 145
>> 22112 17:06:52.920561 times({tms_utime=0, tms_stime=0, tms_cutime=0,
>> tms_cstime=0}) = 432369321
>> 22112 17:06:52.920626 shutdown(11, 1 /* send */) = 0
> 
> Please provide a gdb backtrace of the process when it waits for data from
> the backend (http://httpd.apache.org/dev/debugging.html).
> 
> Regards
> 
> Rüdiger
> 

here is backtrace

Thread 3 (Thread 0x41001950 (LWP 23592)):
#0  0x00002ac75a2bbbe6 in poll () from /lib/libc.so.6
#1  0x00002ac759889b44 in apr_wait_for_io_or_timeout (f=<value optimized
out>,
    s=<value optimized out>, for_read=-1) at support/unix/waitio.c:51
#2  0x00002ac75988572a in apr_socket_recv (sock=0x6c92e8, buf=0x724868
"", len=0x40ffca88)
    at network_io/unix/sendrecv.c:87
#3  0x00002ac7595390b4 in socket_bucket_read (a=0x711008,
str=0x40ffca90, len=0x40ffca88,
    block=<value optimized out>) at buckets/apr_buckets_socket.c:36
#4  0x00002ac759537b5a in apr_brigade_split_line (bbOut=<value optimized
out>, bbIn=0x71b948,
    block=APR_BLOCK_READ, maxbytes=8192) at buckets/apr_brigade.c:292
#5  0x0000000000434117 in ap_core_input_filter (f=0x70fb70, b=0x71bb00,
mode=AP_MODE_GETLINE,
    block=APR_BLOCK_READ, readbytes=0) at core_filters.c:155
#6  0x00000000004685f8 in ap_http_filter (f=0x71ba68, b=0x70fe38,
mode=AP_MODE_READBYTES,
    block=APR_NONBLOCK_READ, readbytes=8192) at http_filters.c:292
#7  0x000000000045c049 in ap_proxy_http_process_response (p=0x70e798,
r=0x712828,
    backend=0x651a78, origin=0x70f388, conf=0x6bf8a0,
server_portstr=0x41000de0 "")
    at mod_proxy_http.c:1494
#8  0x000000000045d592 in proxy_http_handler (r=0x712828, worker=<value
optimized out>,
    conf=0x6bf8a0, url=0x70f380 "/a.php", proxyname=0x0,
proxyport=<value optimized out>)
    at mod_proxy_http.c:1742
#9  0x000000000044fde0 in proxy_run_scheme_handler (r=0x712828,
worker=0x6bfa70, conf=0x6bf8a0,
    url=0x716de6 "http://127.0.0.1:81/a.php", proxyhost=0x0,
proxyport=<value optimized out>)
    at mod_proxy.c:2150
#10 0x00000000004534c7 in proxy_handler (r=0x712828) at mod_proxy.c:822
#11 0x0000000000434859 in ap_run_handler (r=0x712828) at config.c:157
#12 0x000000000043793c in ap_invoke_handler (r=0x712828) at config.c:372
#13 0x0000000000466b48 in ap_process_request (r=0x712828) at
http_request.c:258
#14 0x000000000046402c in ap_process_http_connection (c=0x70ea20) at
http_core.c:184
#15 0x000000000043b4e1 in ap_run_process_connection (c=0x70ea20) at
connection.c:43
#16 0x000000000047e136 in worker_thread (thd=0x6c35f8, dummy=<value
optimized out>)
    at worker.c:544
#17 0x00002ac759dd7317 in start_thread () from /lib/libpthread.so.0
#18 0x00002ac75a2c4b1d in clone () from /lib/libc.so.6
#19 0x0000000000000000 in ?? ()

-- 
Pavel Stano

Mime
View raw message