ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:110626] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock
@ 2022-11-05 18:00 byroot (Jean Boussier)
  2022-11-13  2:23 ` [ruby-core:110732] " nagachika (Tomoyuki Chikanaga)
  0 siblings, 1 reply; 2+ messages in thread
From: byroot (Jean Boussier) @ 2022-11-05 18:00 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:110732] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock
  2022-11-05 18:00 [ruby-core:110626] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock byroot (Jean Boussier)
@ 2022-11-13  2:23 ` nagachika (Tomoyuki Chikanaga)
  0 siblings, 0 replies; 2+ messages in thread
From: nagachika (Tomoyuki Chikanaga) @ 2022-11-13  2:23 UTC (permalink / raw)
  To: ruby-core

Issue #19105 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.7: DONTNEED, 3.0: REQUIRED, 3.1: REQUIRED to 2.7: DONTNEED, 3.0: REQUIRED, 3.1: DONE

ruby_3_1 61818395312c6e765dc8e7be8bf32cd2c82fec39 merged revision(s) eacedcfe44a0ae22bf54ddb7df193c48d4c857c6.

----------------------------------------
Bug #19105: mutex: Raise a ThreadError when detecting a fiber deadlock
https://bugs.ruby-lang.org/issues/19105#change-100067

* Author: byroot (Jean Boussier)
* Status: Closed
* Priority: Normal
* Backport: 2.7: DONTNEED, 3.0: REQUIRED, 3.1: DONE
----------------------------------------
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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-13  2:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-05 18:00 [ruby-core:110626] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock byroot (Jean Boussier)
2022-11-13  2:23 ` [ruby-core:110732] " nagachika (Tomoyuki Chikanaga)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).