Actions
Bug #15385
closedRuby 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
-
Timeout
is unnecessary and was added to illustrate that it has no effect to interrupt hanged process. -
Process.pid
is printed for convenience to kill hanged process. - Printing
value
in ensure changes behavior, there is no hang when encounteringvalue if nil
below.
I've also checked ruby 2.6.0preview3 (2018-11-06 trunk 65578) [x86_64-darwin18]
and the problem persists.
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0