From: "byroot (Jean Boussier)" <noreply@ruby-lang.org>
To: ruby-core@neon.ruby-lang.org
Subject: [ruby-core:110626] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock
Date: Sat, 05 Nov 2022 18:00:15 +0000 (UTC) [thread overview]
Message-ID: <redmine.issue-19105.20221105180015.7941@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19105.20221105180015.7941@ruby-lang.org
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/
next parent reply other threads:[~2022-11-05 18:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 18:00 byroot (Jean Boussier) [this message]
2022-11-13 2:23 ` [ruby-core:110732] [Ruby master Bug#19105] mutex: Raise a ThreadError when detecting a fiber deadlock nagachika (Tomoyuki Chikanaga)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.issue-19105.20221105180015.7941@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
--cc=ruby-core@neon.ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).