Random crash with memory corruption symptoms
Summary
While running a test-suite for the streaming library streamly I am encountering a crash which shows up at different places at different times. The common messages are:
- Segmentation fault: 11
- internal error: scavenge_mark_stack: unimplemented/strange closure type 24792696 @ 0x4200a623e0
- internal error: update_fwd: unknown/strange object 223743520
and several other such messages.
Steps to reproduce
The current reproducer code is at https://github.com/composewell/streamly on the ghc-segfault branch. Use $ while true; do cabal run properties || break; done
in the shell and wait for the crash. The test code is in test/Prop.hs
- here https://github.com/composewell/streamly/blob/ghc-segfault/test/Prop.hs .
This issue only shows when the following conditions are met:
- hspec "parallel" combinator is used to run tests in parallel
- streamly concurrent code is being tested which can create many threads
- The GHC heap size is restricted to a small size ~32MB using "-M32M" rts option. It never occurs when the heap size is not restricted.
I am trying to simplify the reproducing code further to remove other factors as much as possible.
Expected behavior
It should keep running without a crash.
Environment
- GHC Version: It is consistently seen with GHC 8.6.5 as well as GHC 8.8.2
- Operating System: Mac OSX
- System Architecture: x86-64