Skip to content
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

Fix preview_mt infinite loop on Windows #13419

Merged

Conversation

HertzDevil
Copy link
Contributor

After #13362, all programs on Windows will get stuck while initializing constants if -Dpreview_mt is provided:

  • Crystal::OnceState#once calls Mutex#lock
  • which calls Fiber.current
  • which calls Crystal::Scheduler.current_fiber
  • which calls Thread#scheduler
  • which calls Crystal::Scheduler.new
  • which initializes @fiber_channel by calling Crystal::FiberChannel.new
  • which initializes @worker_out and @worker_in by calling IO.pipe
  • which calls Crystal::System::FileDescriptor.pipe
  • which now refers to constants yet to be initialized, calling Crystal::OnceState#once
  • ...

This PR breaks the loop so that programs will at least continue to run with -Dpreview_mt (and work as long as no concurrency or multithreading features are used).

@HertzDevil HertzDevil added kind:bug platform:windows topic:multithreading kind:regression Something that used to correctly work but no longer works labels May 2, 2023
@straight-shoota straight-shoota added this to the 1.9.0 milestone May 2, 2023
@straight-shoota straight-shoota merged commit 2e43fc4 into crystal-lang:master May 3, 2023
@HertzDevil HertzDevil deleted the bug/windows-preview_mt branch May 3, 2023 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants