ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "nagachika (Tomoyuki Chikanaga) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "nagachika (Tomoyuki Chikanaga)" <noreply@ruby-lang.org>
Subject: [ruby-core:120068] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted.
Date: Sat, 30 Nov 2024 06:11:36 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-110811.20241130061135.3344@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20907.20241123232652.3344@ruby-lang.org>

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

Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED

ruby_3_2 commit:87249cbddb5dbac16cb7f0fa33958a42389759cb merged revision(s) commit:a8c2d5e7bee5fad0965baeb58d312ddc5932ec26.

----------------------------------------
Bug #20907: Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted.
https://bugs.ruby-lang.org/issues/20907#change-110811

* Author: ioquatix (Samuel Williams)
* Status: Closed
* Assignee: ioquatix (Samuel Williams)
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED
----------------------------------------
The following test fails with a `ThreadError` instead of a `RuntimeError`:

```ruby
  def test_condition_variable
    condition_variable = ::Thread::ConditionVariable.new
    mutex = ::Thread::Mutex.new

    error = nil

    thread = Thread.new do
      Thread.current.report_on_exception = false

      scheduler = Scheduler.new
      Fiber.set_scheduler scheduler

      fiber = Fiber.schedule do
        begin
          mutex.synchronize do
            condition_variable.wait(mutex)
          end
        rescue => error
        end
      end

      fiber.raise(RuntimeError)
    end

    thread.join
    assert_kind_of RuntimeError, error
  end
```

Fix: https://github.com/ruby/ruby/pull/12158



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

  reply	other threads:[~2024-11-30  6:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-23 23:26 [ruby-core:119998] " ioquatix (Samuel Williams) via ruby-core
2024-11-30  6:11 ` nagachika (Tomoyuki Chikanaga) via ruby-core [this message]
2025-01-15  1:48 ` [ruby-core:120681] " k0kubun (Takashi Kokubun) via ruby-core

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-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-110811.20241130061135.3344@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@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 NNTP newsgroup(s).