Garbage collector crashes in simple parallel sorting program
I have a very simple parallel program that crashes quite reproducibly. On x86-64 and x86-32, the symptoms are subtly different, but equally catastrophic.
x86-64:
$ ghc -threaded -O2 --make -o Sorting Sorting
[1 of 1] Compiling Main ( Sorting.hs, Sorting.o )
Linking Sorting ...
$ ./Sorting +RTS -N2 -RTS 100000
100000
Segmentation fault
x86-32:
$ ghc -O2 --make -threaded -o Sorting Sorting
[1 of 1] Compiling Main ( Sorting.hs, Sorting.o )
Linking Sorting ...
$ ./Sorting +RTS -N2 -RTS 125000
125000
Sorting: internal error: evacuate: strange closure type 17805
(GHC version 6.8.2 for i386_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Aborted
Here's a somewhat useless backtrace from gdb on x86-64:
#1 0x00007fb49eac2d83 in abort () at abort.c:88
#2 0x0000000000444c45 in rtsFatalInternalErrorFn ()
#3 0x0000000000444efc in barf ()
#4 0x0000000000464c9c in evacuate ()
#5 0x000000000044d213 in scavenge_stack ()
#6 0x000000000044e4ba in scavenge_one ()
#7 0x000000000044e8d6 in scavenge_mutable_list ()
#8 0x000000000044bc49 in GarbageCollect ()
#9 0x0000000000445d1f in scheduleDoGC ()
#10 0x0000000000446ff8 in schedule ()
#11 0x0000000000447339 in workerStart ()
#12 0x0000000000f6c29a in start_thread (arg=<value optimized out>)
at pthread_create.c:297
#13 0x00007fb49eb732cd in clone () from /lib64/libc.so.6