* [ruby-core:119998] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted.
@ 2024-11-23 23:26 ioquatix (Samuel Williams) via ruby-core
2024-11-30 6:11 ` [ruby-core:120068] " nagachika (Tomoyuki Chikanaga) via ruby-core
2025-01-15 1:48 ` [ruby-core:120681] " k0kubun (Takashi Kokubun) via ruby-core
0 siblings, 2 replies; 3+ messages in thread
From: ioquatix (Samuel Williams) via ruby-core @ 2024-11-23 23:26 UTC (permalink / raw)
To: ruby-core; +Cc: ioquatix (Samuel Williams)
Issue #20907 has been reported by ioquatix (Samuel Williams).
----------------------------------------
Bug #20907: Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted.
https://bugs.ruby-lang.org/issues/20907
* Author: ioquatix (Samuel Williams)
* Status: Open
* Assignee: ioquatix (Samuel Williams)
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:120068] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted.
2024-11-23 23:26 [ruby-core:119998] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted ioquatix (Samuel Williams) via ruby-core
@ 2024-11-30 6:11 ` nagachika (Tomoyuki Chikanaga) via ruby-core
2025-01-15 1:48 ` [ruby-core:120681] " k0kubun (Takashi Kokubun) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: nagachika (Tomoyuki Chikanaga) via ruby-core @ 2024-11-30 6:11 UTC (permalink / raw)
To: ruby-core; +Cc: nagachika (Tomoyuki Chikanaga)
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:120681] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted.
2024-11-23 23:26 [ruby-core:119998] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted ioquatix (Samuel Williams) via ruby-core
2024-11-30 6:11 ` [ruby-core:120068] " nagachika (Tomoyuki Chikanaga) via ruby-core
@ 2025-01-15 1:48 ` k0kubun (Takashi Kokubun) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: k0kubun (Takashi Kokubun) via ruby-core @ 2025-01-15 1:48 UTC (permalink / raw)
To: ruby-core; +Cc: k0kubun (Takashi Kokubun)
Issue #20907 has been updated by k0kubun (Takashi Kokubun).
Backport changed from 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED to 3.1: REQUIRED, 3.2: DONE, 3.3: DONE
ruby_3_3 commit:f19831a15d680fd995ceaecad1157282be7182dc 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-111504
* Author: ioquatix (Samuel Williams)
* Status: Closed
* Assignee: ioquatix (Samuel Williams)
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: DONE
----------------------------------------
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-15 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-23 23:26 [ruby-core:119998] [Ruby master Bug#20907] Fiber scheduler does not correctly re-lock mutex if `Mutex#sleep` is interrupted ioquatix (Samuel Williams) via ruby-core
2024-11-30 6:11 ` [ruby-core:120068] " nagachika (Tomoyuki Chikanaga) via ruby-core
2025-01-15 1:48 ` [ruby-core:120681] " k0kubun (Takashi Kokubun) via ruby-core
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).