Skip to content
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

Timeout not not exiting aggressively enough #44

Closed
litch opened this issue May 3, 2014 · 1 comment
Closed

Timeout not not exiting aggressively enough #44

litch opened this issue May 3, 2014 · 1 comment

Comments

@litch
Copy link

litch commented May 3, 2014

I'm running a Rails 4.1 application that's fairly simple, connecting to Postgres. In both development and production environments I'm having problems with requests timing out. When I'm serving with Unicorn, the unicorn timeout can kill a process appropriaetly (though I don't get the exception sent out to logs or NewRelic or anything). I installed rack-timout, and it's "working" but it's unable to kill the requests.

user@1dde41d2aee9:/rails# rake middleware
use Rack::Timeout
use Librato::Rack
use Rack::Sendfile
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007f34cd513ac0>
use Rack::Runtime
...
#config/initializers/rack_timeout.rb
Rack::Timeout.timeout = 1
#merged unicorn_rails & application logs - stdout
source=rack-timeout id=075e816b5792ba35125ac51f55b3b61f timeout=1000ms state=ready at=info
I, [2014-05-03T16:53:11.425984 #1063]  INFO -- : Started GET "/markets/3" for 70.114.154.225 at 2014-05-03 16:53:11 +0000
I, [2014-05-03T16:53:11.427974 #1063]  INFO -- : Processing by MarketsController#show as HTML
I, [2014-05-03T16:53:11.428099 #1063]  INFO -- :   Parameters: {"id"=>"3"}
source=rack-timeout id=075e816b5792ba35125ac51f55b3b61f timeout=1000ms duration=1000ms state=timed_out at=error
E, [2014-05-03T16:54:12.188483 #1060] ERROR -- : worker=0 PID:1063 timeout (61s > 60s), killing
E, [2014-05-03T16:54:12.216382 #1060] ERROR -- : reaped #<Process::Status: pid 1063 SIGKILL (signal 9)> worker=0

I suspect it's a postgres IO issue that I'm hunting (rails/rails#12867), but just opening this because it seems like rack-timeout should be able to kill this.

@litch
Copy link
Author

litch commented May 4, 2014

It seems like I had a rescue Timeout::Error somewhere to catch a process that I expected to timeout occasionally, and that was catching the Rack::Timeout::RequestTimeoutError. I don't understand what, why or how, but removing that timeout block (more precisely, the rescue Timeout::Error caused Rack::Timeout to function properly.

@litch litch closed this as completed May 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant