Note that there are some explanatory texts on larger screens.

plurals
  1. POcatching timeout exceptions in rails seems to skip rescues and explode "all the way up"
    text
    copied!<p>I have a controller:</p> <pre><code>class EventsController &lt; ApplicationController def index begin SystemTimer.timeout_after(10, CustomTimeoutError) do sleep(11) end rescue CustomTimeoutError =&gt; e # swallow end end end </code></pre> <p>For some reason the rescue statement is not catching the timeout but instead its bubbling all the way up to the top, stacktrace gets dumped to console etc. Using the defatult Timeout::Error has the same effect. This happens only on production, not on my development machine. It's as though something else is watching for timeouts and capturing them before it event reaches my rescue.</p> <p>The stacktrace produced is this:</p> <pre><code>[GEM_ROOT]/gems/SystemTimer-1.2/lib/system_timer/concurrent_timer_pool.rb:63:in `read_reply' vendor/gems/redis-1.0.4/lib/redis/client.rb:444:in `process_command' vendor/gems/redis-1.0.4/lib/redis/client.rb:442:in `map' vendor/gems/redis-1.0.4/lib/redis/client.rb:442:in `process_command' vendor/gems/redis-1.0.4/lib/redis/client.rb:431:in `raw_call_command' vendor/gems/redis-1.0.4/lib/redis/client.rb:452:in `call' vendor/gems/redis-1.0.4/lib/redis/client.rb:452:in `maybe_lock' vendor/gems/redis-1.0.4/lib/redis/client.rb:428:in `raw_call_command' vendor/gems/redis-1.0.4/lib/redis/client.rb:332:in `call_command' vendor/gems/redis-1.0.4/lib/redis/client.rb:381:in `method_missing' vendor/gems/ohm-0.0.35/lib/ohm/collection.rb:179:in `size' vendor/gems/ohm-0.0.35/lib/ohm/collection.rb:65:in `empty?' vendor/gems/ohm-0.0.35/lib/ohm/collection.rb:33:in `sort' vendor/gems/ohm-0.0.35/lib/ohm/collection.rb:48:in `first' vendor/gems/ohm-0.0.35/lib/ohm.rb:129:in `first' lib/twitter_helper.rb:58:in `get_twitter_searches' lib/twitter_helper.rb:57:in `each' lib/twitter_helper.rb:57:in `get_twitter_searches' lib/twitter_helper.rb:100:in `get_twitter_searches_or_messages' app/controllers/events_controller.rb:66:in `show' [GEM_ROOT]/gems/SystemTimer-1.2/lib/system_timer.rb:56:in `timeout_after' app/controllers/events_controller.rb:65:in `show' vendor/rails/actionpack/lib/action_controller/base.rb:1331:in `send' </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload