CAF blackhole deadlock - stack check between newCAF and pushing update frame
The hedgehog authors noticed tests hanging, https://github.com/hedgehogqa/haskell-hedgehog/pull/550 . The library uses the `tasty` framework to run threads in multiple threads, `tasty` in turn uses part of the `async` lib.
I've reproduced it with GHC 9.12, making a few changes to the hedgehog reproducer:
* removed `unsafePerformIO` (was only used for initializing the random seed)
* changed the `readFile` in the test case to `threadDelay`
self-contained reproducer is still work in progress.
What's going on: A thread uses `lockCAF` but pauses before pushing the update frame with the CAF onto the stack. This happens when the stack check in `stg_unpack_cstring` fails. Because the thread pauses, other threads can block on the black hole before `threadPaused` has seen it (since it doesn't see the update frame on the stack). Later, in another `threadPaused` call the blocking queue gets overwritten and threads in the queue remain blocked forever. See !14734 for more discussion.
issue