Blocked OS threads can prevent a program from shutting down #805
Labels
accepting contributions
Issues that are suitable to be worked on by anybody, not just maintainers
bug
Defects, unintended behaviour, etc
runtime
Changes related to the Rust-based runtime library
Milestone
Please describe the bug
Consider the following program (per the Discord):
When running this the program will hang after printing "got a timeout!". This is because the process calling
Stdin.read
blocks the OS thread. This in turn results in us getting stuck when joining the process threads here:inko/rt/src/scheduler/process.rs
Lines 1013 to 1057 in 73e5f0f
For the worker threads we shouldn't need to use
scoped
, which means we can fix this by just spawning the threads the usual way and forgetting about them when shutting down. This does require that instead of threads capturing a&State
, they instead each get a uniqueRcState
.Operating system
Fedora
Inko version
main
The text was updated successfully, but these errors were encountered: