Can't catch Timeout::Error within timeout block
-----------------------------------------------
Key: JRUBY-5194
URL: http://jira.codehaus.org/browse/JRUBY-5194
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.5.5
Reporter: Brad Pardee
Priority: Minor
Attachments: b.rb
JRuby doesn't allow you to catch a Timeout::Error within a Timeout.timeout
block which you may want to do if you want to handle all exceptions but
timeouts. This acts differently from MRI which does allow this. I think it
instead creates some kind of anonymous exception for performance reasons. The
workaround I'm using is to look for expired in the message as follows but I
don't really like this since it depends on the text.
Timeout.timeout(5) do
begin
...
rescue Exception => e
raise if e.message =~ /expired/
...
end
end
I've attached a small programs which demonstrates the problem.
I know the answer is "Don't use timeout!" but our infrastructure depends on it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email