From: "byroot (Jean Boussier)" Date: 2022-11-05T18:00:15+00:00 Subject: [ruby-core:110626] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock Issue #19105 has been reported by byroot (Jean Boussier). ---------------------------------------- Bug #19105: mutex: Raise a ThreadError when detecting a fiber deadlock https://bugs.ruby-lang.org/issues/19105 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Backport: 2.7: DONTNEED, 3.0: REQUIRED, 3.1: REQUIRED ---------------------------------------- The following code can lead to a deadlock but not raise any error: ```ruby mutex = Mutex.new mutex.synchronize do error = assert_raise ThreadError do Fiber.new do mutex.lock end.resume end end ``` If no fiber scheduler is registered, and both the fiber that currently own the lock and the one trying to acquire it belongs to the same thread, then this deadlock situation cannot possibly resolve (aside from a signal interrupt maybe). Discussed in https://bugs.ruby-lang.org/issues/17827#note-10 Pull request: https://github.com/ruby/ruby/pull/6680 -- https://bugs.ruby-lang.org/ Unsubscribe: