-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connect_timeout and inactivity_timeout not working with eventmachine 1.0.1 #222
Comments
Nope, needs to fixed in EM. /cc @tmm1 ... Short of adding extra timers to handle this yourself, this is not something em-http should address. |
The only related commit in 1.0.1 is eventmachine/eventmachine@3c39365 (eventmachine/eventmachine#374). Can you try with and without that commit? |
ok, I tried and confirmed that reverting eventmachine/eventmachine@3c39365 fixed the problem. So, it seems like a regression indeed. |
Interesting. If you use |
Here's the result matrix - I find it's quite interesting indeed. Note that I built "fixed" EM as 1.0.1.1, and used
|
Ok, this is clearly broken in 1.0.1. There's even a failing test on master. I'll try to come up with a solution that fixes the test and the original issue in eventmachine/eventmachine#374 See also #149 |
I believe this patch will fix all the timeout weirdness. Can you try your combination test again? diff --git a/ext/ed.cpp b/ext/ed.cpp
index 9ebd4b1..48f3c5c 100644
--- a/ext/ed.cpp
+++ b/ext/ed.cpp
@@ -460,8 +460,7 @@ ConnectionDescriptor::SetConnectPending
void ConnectionDescriptor::SetConnectPending(bool f)
{
bConnectPending = f;
- if (f == false && NextHeartbeat)
- MyEventMachine->ClearHeartbeat(NextHeartbeat, this);
+ MyEventMachine->QueueHeartbeat(this);
_UpdateEvents();
}
|
this reverts a change made for #374, which inadvertently disabled inactivity timeouts altogether. instead we always QueueHeartbeat when bConnectPending changes, so GetNextHeartbeat can calculate a timeout based on the new connection state. i confirmed this fixes the broken test on master, and the original "20s delay" bug (using the repro in #393). this should also address the timeout stacking issue reported in igrigorik/em-http-request#149, as well as the original report in igrigorik/em-http-request#222
@tmm1 Good news - it worked! Also, the most accurate timeout ever - results are almost exactly the same as
|
Excellent. I've released EM v1.0.2. |
Awesome - great job guys! I take it, we can close this bug then? :) |
@tmm1 @igrigorik I've just deployed EM v1.0.3 to production and confirmed the problems is fixed for real. Thank you! |
# Changelog ## 1.0.x * EM.system was broken in 1.0.2 release [#413] ## 1.0.2 (March 8, 2013) * binary win32 gems now include fastfilereader shim [#222] * fix long-standing connection timeout issues [27fdd5b, igrigorik/em-http-request#222] * http and line protocol cleanups [#193, #151] * reactor return value cleanup [#225] * fix double require from gemspec [#284] * fix smtp server reset behavior [#351] * fix EM.system argument handling [#322] * ruby 1.9 compat in smtp server and stomp protocols [#349, #315] * fix pause from post_init [#380] ## 1.0.1 (February 27, 2013) * use rb_wait_for_single_fd() on ruby 2.0 to fix rb_thread_select() deprecation * fix epoll/kqueue mode in ruby 2.0 by removing calls to rb_enable_interrupt() [#248, #389] * fix memory leak when verifying ssl cerificates [#403] * fix initial connection delay [#393, #374]
# Changelog ## 1.0.x * EM.system was broken in 1.0.2 release [#413] ## 1.0.2 (March 8, 2013) * binary win32 gems now include fastfilereader shim [#222] * fix long-standing connection timeout issues [27fdd5b, igrigorik/em-http-request#222] * http and line protocol cleanups [#193, #151] * reactor return value cleanup [#225] * fix double require from gemspec [#284] * fix smtp server reset behavior [#351] * fix EM.system argument handling [#322] * ruby 1.9 compat in smtp server and stomp protocols [#349, #315] * fix pause from post_init [#380] ## 1.0.1 (February 27, 2013) * use rb_wait_for_single_fd() on ruby 2.0 to fix rb_thread_select() deprecation * fix epoll/kqueue mode in ruby 2.0 by removing calls to rb_enable_interrupt() [#248, #389] * fix memory leak when verifying ssl cerificates [#403] * fix initial connection delay [#393, #374]
# Changelog ## 1.0.x * EM.system was broken in 1.0.2 release [#413] ## 1.0.2 (March 8, 2013) * binary win32 gems now include fastfilereader shim [#222] * fix long-standing connection timeout issues [27fdd5b, igrigorik/em-http-request#222] * http and line protocol cleanups [#193, #151] * reactor return value cleanup [#225] * fix double require from gemspec [#284] * fix smtp server reset behavior [#351] * fix EM.system argument handling [#322] * ruby 1.9 compat in smtp server and stomp protocols [#349, #315] * fix pause from post_init [#380] ## 1.0.1 (February 27, 2013) * use rb_wait_for_single_fd() on ruby 2.0 to fix rb_thread_select() deprecation * fix epoll/kqueue mode in ruby 2.0 by removing calls to rb_enable_interrupt() [#248, #389] * fix memory leak when verifying ssl cerificates [#403] * fix initial connection delay [#393, #374]
Here's the source to reproduce the problem:
The server returns a response in 6 seconds, while the timeout values are set an earlier point.
When I run this, I get
As you can see, it's not timing out and wait (indefinitely) until we get the response.
However, when I activate the gem pinning to 1.0.0, then run
So it times out after 4 seconds as expected.
Probably it's a regression in EventMachine 1.0.1 but I wasn't able to find out what change is causing this. Any advice on fix / workaround?
The text was updated successfully, but these errors were encountered: