-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash in fiber switching with select #3900
Comments
Did some playing around with this today. Doesn't seem to happen if case statement is changed to if, and doesn't seem to happen if case statement is changed to if/elsif (with or without plain else statement). |
i tried to debug this, but its quite hard, something breaks in coroutines switches. |
Because there is a same fiber in ch1 = Channel(Int32).new(1)
ch2 = Channel(Int32).new(1)
res = [] of Int32
class Scheduler
def self.log
LibC.printf "#{@@runnables}\n"
end
end
a = spawn do
loop do
select
when x = ch1.receive
res << x
when y = ch2.receive
res << y
end
LibC.printf "receive: "
Scheduler.log
end
end
b = spawn do
3.times do |i|
select
when ch1.send(i)
when ch2.send(i)
end
LibC.printf "send: "
Scheduler.log
end
end
p "receive fiber : #{a}"
p "send fiber : #{b}"
Fiber.yield
p res
After third sending, the fiber are going to the end and |
- Fixes crystal-lang#3900 crystal-lang#3862 - Fully thread safe except coroutine switch
- Fixes crystal-lang#3900 crystal-lang#3862 - Fully thread safe except coroutine switch
- Fixes crystal-lang#3900 crystal-lang#3862 - Fully thread safe except coroutine switch
- Fixes crystal-lang#3900 crystal-lang#3862 - Fully thread safe except coroutine switch
#triage This issue appears to persist with 0.23.1 https://carc.in/#/r/2imm An effort to rewrite the Channel implementation has been undertaken in #3912, and also appears to have not much feedback. |
It doesn't segfault anymore, but still crashes at runtime: https://carc.in/#/r/7gtb Somebody wants to try it against #8112? :) |
I tried it with #8112 and it works fine 🎉 |
Closed by #8112 Please reopen if the issue remains. |
The text was updated successfully, but these errors were encountered: