https://bz.apache.org/bugzilla/show_bug.cgi?id=61616

--- Comment #21 from Carsten Wolff <cars...@wolffcarsten.de> ---
(In reply to Yann Ylavic from comment #19)
> Thanks for the patch Carsten, but there can't be an exception for
> send_brigade_blocking() to block when the conditions are met, the core
> output filter must control the memory buckets in flight (set aside).

Sure, using the timeout value as a criterion in send_brigade_blocking is ugly.
I see there's a APR_NONBLOCK_READ flag one can pass to ap_get_brigade(). Maybe
there should be a APR_NONBLOCK_WRITE flag one could pass to ap_pass_brigade()
(and further down to send_brigade_blocking) to absolutely make sure, the poll()
there is never hit?

(In reply to Yann Ylavic from comment #20)
> Created attachment 35446 [details]
> Handle POLLOUT in proxy_connect (v6)
> 
> This new patch gives more control (flags) to the caller of
> ap_proxy_transfer_between_connections(), which can now stop its loop when
> the output filter chain starts buffering data.
>
> It also refactors proxy_connect_handler() to have a symetric loop because
> the logic had to be duplicated on both sides (the more we add logic, the
> less it becomes readable).

Much nicer indeed, you also choose the right socket on POLLOUT now, which was
wrong in v5.

> I made more testing with it and it seems to work as expected here..

It gives me a hard time to reproduce the original issue. :-) But, it now blocks
at the end of the transfer in mod_proxy_connect's poll() for 300 seconds before
finishing successfully. See backtrace and log below.

> I also have an update for attachment 35427 [details] but this patch is
> actually barely related (the above patch should work on its own for the
> proxy connect case).
> 
> I can provide it here too if you wish because it allows to transfer more
> than 8K bytes at a time (a current limitation in mod_proxy_connect).

This might be interesting for performance of connections on loopback, where the
segment size is 64k.

Current backtrace:
Thread 2 (Thread 0x7ffa5f0b9700 (LWP 5797)):
#0  0x00007ffa63d180f3 in epoll_wait () at
../sysdeps/unix/syscall-template.S:84
#1  0x00007ffa6420e201 in impl_pollset_poll (pollset=0x7ffa64990f78,
timeout=<optimized out>, num=0x7ffa5f0b6a94, descriptors=0x7ffa5f0b6aa0) at
./poll/unix/epoll.c:266
#2  0x00007ffa60b263b7 in proxy_connect_handler (r=0x7ffa6498f0a0,
worker=<optimized out>, conf=<optimized out>, url=<optimized out>,
proxyname=<optimized out>, 
    proxyport=<optimized out>) at mod_proxy_connect.c:442


Log tail of the end of the transfer:
[Sat Oct 21 16:28:29.475904 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:28:29.476140 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 8192/8192 bytes
[Sat Oct 21 16:28:29.476241 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:28:29.476510 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 8192/8192 bytes
[Sat Oct 21 16:28:29.476685 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:28:29.476985 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 8192/8192 bytes
[Sat Oct 21 16:33:46.176810 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.178932 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.179110 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [remote ::1:873] writev_nonblocking: 4/4 bytes
[Sat Oct 21 16:33:46.186064 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 4272/4272 bytes
[Sat Oct 21 16:33:46.199852 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.200032 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [remote ::1:873] writev_nonblocking: 5/5 bytes
[Sat Oct 21 16:33:46.200317 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.200365 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 5/5 bytes
[Sat Oct 21 16:33:46.200793 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.200898 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [remote ::1:873] writev_nonblocking: 7/7 bytes
[Sat Oct 21 16:33:46.200920 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.200952 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 6/6 bytes
[Sat Oct 21 16:33:46.242005 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.242141 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [client ::1:33340] writev_nonblocking: 25/25 bytes
[Sat Oct 21 16:33:46.242524 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.244044 2017] [core:trace6] [pid 5795:tid 140713313146624]
core_filters.c(878): [remote ::1:873] writev_nonblocking: 5/5 bytes
[Sat Oct 21 16:33:46.256132 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.256195 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): (70014)End of file found: [client ::1:33340]
ap_proxy_transfer_between_connections complete
[Sat Oct 21 16:33:46.256236 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): [client ::1:33340] ap_proxy_transfer_between_connections
complete
[Sat Oct 21 16:33:46.256245 2017] [proxy:trace2] [pid 5795:tid 140713313146624]
proxy_util.c(3845): (70014)End of file found: [client ::1:33340]
ap_proxy_transfer_between_connections complete
[Sat Oct 21 16:33:46.256368 2017] [proxy_connect:trace2] [pid 5795:tid
140713313146624] mod_proxy_connect.c(558): [client ::1:33340] finished with
poll() - cleaning up

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscr...@httpd.apache.org
For additional commands, e-mail: bugs-h...@httpd.apache.org

Reply via email to