You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Artem Grinblat <ar...@gmail.com> on 2014/03/30 12:23:41 UTC

[users@httpd] Problems closing connections in a SUSPENDED test case

I've come up with an (almost) working SUSPENDED test case:
https://gist.github.com/ArtemGr/9870554
It works in browser and with "curl -v http://127.0.0.1/sustest", at least
for some time.

Apache version is 2.4.7 (Debian Jessie).

Problem is, when I test it with ab (ab -n 999 -c 9 http://127.0.0.1/sustest)
it just sits there and then tells me "apr_pollset_poll: The timeout
specified has expired (70007)".

I suspect the connections aren't properly released but I don't really know.

Please help me understand what's wrong with the test case.
Am I doing something wrong or is it a bug in Apache?

Re: [users@httpd] Problems closing connections in a SUSPENDED test case

Posted by Eric Covener <co...@gmail.com>.
Please open a bug
 for the issue.  trunk also has a facility to get called back when a
socket is readable, mod_proxy_wstunnel uses it. It really needs a timeout
to be useful.

Re: [users@httpd] Problems closing connections in a SUSPENDED test case

Posted by Artem Grinblat <ar...@gmail.com>.
Thanks a lot!

I've made a hack which puts the suspeded connection back in the queue:
https://gist.github.com/ArtemGr/9887564
with that the test case works! (`ab` no longer timeouts).

Would it make sense to submit a feature request along these lines?
Should I make a patch or leave it to the more experienced Apache developers?

It looks like new APIs are needed -- either in a new timed callback
> API, or something usable from the callback function.
>

Timed callback is just a convenience, the real code might use its own even
loop and/or threads, so something usable from the callback is definitely
better.

BTW, Cherokee has an interesting way about that, allowing the connection to
wait on an arbitrary file descriptor. So one can make a `pipefd` file
descriptor just to wake the connection up:
https://gist.github.com/ArtemGr/5797289

On Mon, Mar 31, 2014 at 5:00 AM, Eric Covener <co...@gmail.com> wrote:

> Without looking at it too deeply, It seems like suspendable handlers
> (that continue on as HTTP) are not really working.
>
> When your timed callback ends, the underlying socket is not in the
> "keepalive" queue anymore in the MPM. The way it normally gets back
> into that queue is by ap_process_request ending up with state ==
> CONN_STATE_WRITE_COMPLETION, you can see that it doesn't take much to
> hook it back into the keepalive queue in event.c.
>
> It looks like new APIs are needed -- either in a new timed callback
> API, or something usable from the callback function. Unfortunately the
> timed callback is not explicitly connection-rec related now so it
> cannot really sort this out without some hints.
>

Re: [users@httpd] Problems closing connections in a SUSPENDED test case

Posted by Eric Covener <co...@gmail.com>.
Without looking at it too deeply, It seems like suspendable handlers
(that continue on as HTTP) are not really working.

When your timed callback ends, the underlying socket is not in the
"keepalive" queue anymore in the MPM. The way it normally gets back
into that queue is by ap_process_request ending up with state ==
CONN_STATE_WRITE_COMPLETION, you can see that it doesn't take much to
hook it back into the keepalive queue in event.c.

It looks like new APIs are needed -- either in a new timed callback
API, or something usable from the callback function. Unfortunately the
timed callback is not explicitly connection-rec related now so it
cannot really sort this out without some hints.

On Sun, Mar 30, 2014 at 6:23 AM, Artem Grinblat <ar...@gmail.com> wrote:
> I've come up with an (almost) working SUSPENDED test case:
> https://gist.github.com/ArtemGr/9870554
> It works in browser and with "curl -v http://127.0.0.1/sustest", at least
> for some time.
>
> Apache version is 2.4.7 (Debian Jessie).
>
> Problem is, when I test it with ab (ab -n 999 -c 9 http://127.0.0.1/sustest)
> it just sits there and then tells me "apr_pollset_poll: The timeout
> specified has expired (70007)".
>
> I suspect the connections aren't properly released but I don't really know.
>
> Please help me understand what's wrong with the test case.
> Am I doing something wrong or is it a bug in Apache?



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org