The thread switching code assumed that we will always switch out of a thread due to being blocked on an unavailable future. This allows the core to store the blocked thread's context in the synthetic continuation chained to that future (which switched back to that thread). That assumption failed in one place: when we create a thread from within a thread. In that case we switch to the new thread immediately, but forget all about the old thread. We never come back to the old thread, and anything that depends on it hangs. Fix by creating a linked list of active thread contexts. These are all threads that have been "preempted" by the act of creating a new thread, terminated by the main, unthreaded, reactor context. This gives us a place to store those threads and we come back to them and continue where we left off. Reported by Pekka.
6.3 KiB
6.3 KiB