Ruby process hang in ensure
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.
valuein ensure changes behavior, there is no hang when encountering
value if nilbelow.
I've also checked
ruby 2.6.0preview3 (2018-11-06 trunk 65578) [x86_64-darwin18] and the problem persists.
Updated by pawelpacana (Paweł Pacana) about 2 years ago
Updated by nobu (Nobuyoshi Nakada) about 2 years ago
- Status changed from Open to Closed