Behavior
Nested timeout blocks can result in a Timeout::ExitException being raised, rather than a Timeout::Error
How to reproduce
The below will sometimes raise a Timeout::ExitException, sometimes a Timeout::Error (roughly 50/50).
beginTimeout.timeout(2)doTimeout.timeout(2)dosleep3endendrescueException=>eputs"raised a #{e.class}"endCause (maybe)
Hacking up the Timeout module as follows:
moduleTimeoutclassErrordefself.handle_timeout(message)# :nodoc:exc=ExitException.new(message)beginputs"yield #{exc.object_id} (#{message})"yieldexcrescueExitException=>eputs"test #{e.object_id} vs #{exc.object_id} => #{exc.equal?(e)} (#{message})"raisenew(message)ifexc.equal?(e)puts"re-raise #{e.object_id}('#{e}') (#{message})"raiseendendendendTimeout.timeout(2,nil,"outer timeout")doTimeout.timeout(2,nil,"inner timeout")dosleep3endendshows that, when an ExitException is raised, the "inner" exception is being caught by the "outer" handle_timeout block. Suspicious this is the result of indeterminate Thread#raise behavior?
Environment
Ruby 3.3.5
Timeout 0.4.1
Ubuntu 24.04.1 running on WSL2
Behavior
Nested timeout blocks can result in a Timeout::ExitException being raised, rather than a Timeout::Error
How to reproduce
The below will sometimes raise a Timeout::ExitException, sometimes a Timeout::Error (roughly 50/50).
Cause (maybe)
Hacking up the Timeout module as follows:
shows that, when an ExitException is raised, the "inner" exception is being caught by the "outer" handle_timeout block. Suspicious this is the result of indeterminate Thread#raise behavior?
Environment
Ruby 3.3.5
Timeout 0.4.1
Ubuntu 24.04.1 running on WSL2