Mailing List Archive

Issue 1307 in cherokee: timeout setting doesn't work
Status: New
Owner: ----

New issue 1307 by ajmir...@gmail.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

What steps will reproduce the problem?
1. Set timeout setting to 2 seconds via general > network settings >
timeout.
2. Access an item that takes longer than 2 seconds to generate. For example:
> cat index.php
<html><head></head><body><?php sleep(300); ?></body></html>

or when running uwsgi:
> cat timeout_app.py
import time
time.sleep(300)

What is the expected output? What do you see instead?

I expect that cherokee will terminate the interpreter (either fastcgi or
uwsgi) after 2 seconds. However, both are allowed to execute for ~15-17
seconds before cherokee responds with a 504 gateway timeout error.

What version of the product are you using? On what operating system?
version 1.2.101 on ubuntu 11.10

Please provide any additional information below.

This was discovered when trying to increase the timeout from the default of
15 to something larger and the timeout value not seeming to be respected.
Verified that cherokee.conf has a setting server!timeout = 2.


_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #1 on issue 1307 by ste...@konink.de: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

Cherokee will not terminate the interpreter, because unless you are using
CGI Cherokee just can't. Cherokee will terminate your client's network
connection.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #2 on issue 1307 by and...@mirsky.net: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

ah, ok. makes sense. but the server still doesn't seem to be terminating
the client's network connection within the appropriate time set in the
config file or through the admin webserver.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #3 on issue 1307 by etienne....@gmail.com: timeout setting doesn't
work
http://code.google.com/p/cherokee/issues/detail?id=1307

I'm on version 1.2.101 on ubuntu 10.04 and I definitely have the same
problem: to whatever value I set the timeout, in the general tab or
specific to a vserver source, the timeout is always 15 seconds. The server
doesn't care of the settings. I'm over SSL.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #4 on issue 1307 by lnu...@gmail.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

I can confirm this error

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #5 on issue 1307 by da...@davidjb.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

I can confirm this is happening for me on Cherokee 1.2.101 under RHEL 6.2,
using various information sources as the backend for Reverse Proxy handlers.

This bug does seem inconsistent as I've seen the timeout respected (afaict)
on SSL connections with different options.

It definitely does occur though.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #6 on issue 1307 by 246...@gmail.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

AFAICT the timeout is _not_ respected on SSL.


If you look in thread.c , the accept_new_connection() functions:
- Inside get_new_connection call you get the server timeout taken
- Then a bit later, if the connection is SSL, it replaces it by the
cryptor's timeout_handshake which is 15sec by default. (To allow set the
SSL handshake timeout I'd guess).
- The server timeout is never restored once the SSL handshake is down, so
the timeout is fixed to 15 sec ...

What you can do is set a timeout on the 'rule' and this will replace the
conn timeout once the request is parsed and dispatched.

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #7 on issue 1307 by 246...@gmail.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

Here are two experimental patches to fix the timeout issues.

I didn't get a chance to test those myself, I will do so on Monday but if
you're brave enough, feel free to check if it fixes your issue.

Attachments:
0001-rule_list-Update-the-timeout-when-setting-per-rule-t.patch 987 bytes
0002-ssl-Restore-the-server-default-timeout_lapse-once-SS.patch 974 bytes

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #8 on issue 1307 by 246...@gmail.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

I've just tested the two patches and they seem to perform as expected.

The server timeout is now properly used even for SSL. And if you override
it by a 'rule' timeout, it is taken into account every time reliably (and
not erratically like it was before).

I've deployed it to production and nothing bad happened :p

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #9 on issue 1307 by da...@davidjb.com: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

I've tried these patches against the current GitHub master and the issue is
resolved. I've written QA tests to show this accordingly.

Pull request for the patches is here (with QA included):
https://github.com/cherokee/webserver/pull/24

Thanks for the patches!

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Comment #10 on issue 1307 by ste...@konink.de: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

Just submitted my Master Thesis :-) merging window of cool patches will
begin today :)

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev
Re: Issue 1307 in cherokee: timeout setting doesn't work [ In reply to ]
Updates:
Status: Fixed
Labels: Type-Defect Priority-High OpSys-All Component-Logic

Comment #11 on issue 1307 by ste...@konink.de: timeout setting doesn't work
http://code.google.com/p/cherokee/issues/detail?id=1307

Patch has been merged. Thanks very much. Next bug!

_______________________________________________
Cherokee-dev mailing list
Cherokee-dev@lists.octality.com
http://lists.octality.com/listinfo/cherokee-dev