Actions
Bug #15385
closedRuby process hang in ensure
Bug #15385:
Ruby process hang in ensure
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
Backport:
Description
While playing with mutation testing of my code I've found a weird mutation that hangs Ruby process. The isolated code which triggers this freeze is:
require 'timeout'
puts Process.pid
def raise_before_returning
raise
[]
end
def doh
value = raise_before_returning
ensure
# p value # <-- that unblocks it
value if nil
end
Timeout.timeout(3) do
doh
end
Timeoutis unnecessary and was added to illustrate that it has no effect to interrupt hanged process.Process.pidis printed for convenience to kill hanged process.- Printing
valuein ensure changes behavior, there is no hang when encounteringvalue if nilbelow.
I've also checked ruby 2.6.0preview3 (2018-11-06 trunk 65578) [x86_64-darwin18] and the problem persists.
Files
Actions