Disallow pending interrupts to be checked during FiberScheduler#unblock#748
Closed
luke-gruber wants to merge 1 commit intomasterfrom
Closed
Disallow pending interrupts to be checked during FiberScheduler#unblock#748luke-gruber wants to merge 1 commit intomasterfrom
luke-gruber wants to merge 1 commit intomasterfrom
Conversation
b3ea7b1 to
62fa992
Compare
Ractors can send signals at any time, so the previous debug assertion
can fail if a Ractor sends a signal.
```ruby
require 'async/scheduler'
scheduler = Async::Scheduler.new
Fiber.set_scheduler(scheduler)
Signal.trap(:INT) do
end
q = Thread::Queue.new
Thread.new do
loop do
Ractor.new do
Process.kill(:INT, $$)
end.value
end
end
Fiber.schedule do
Fiber.schedule do
1.upto(1000000) do |i|
sleep 0.01
q.pop
q.push(1)
puts "1 iter push/pop"
end
end
Fiber.schedule do
1.upto(1000000) do |i|
sleep 0.01
q.push(i)
q.pop
puts "1 iter push/pop#2"
end
end
end
```
62fa992 to
7f88b34
Compare
|
I worked on a PR (ruby#14588), but I think your implementation is probably better. I'm going to try your implementation (will apply a commit on top of my PR to track progress). |
|
My PR is updated with this fix, I've tested and confirmed the fix according to the reproduction, and have created an upstream bug report. https://bugs.ruby-lang.org/issues/21610 |
|
Merged upstream. |
Author
|
Awesome, thanks! ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ractors can send signals at any time, so the previous debug assertion can fail if a Ractor sends a signal.