Mon Nov 17 06:45:15 PST 2008 Simon Marlow <marlowsd@gmail.com> * Fix #2783: detect black-hole loops properly At some point we regressed on detecting simple black-hole loops. This happened due to the introduction of duplicate-work detection for parallelism: a black-hole loop looks very much like duplicate work, except it's duplicate work being performed by the very same thread. So we have to detect and handle this case.
When running ./validate --slow yesterday, I saw the test for this ticket failing with the threaded1 way. Instead of detecting the loop and aborting with an informative message, we get an assertion failure in the rts/ThreadPaused.c:threadPaused function.
The program:
main=print$dox<-[0..5];let{y=5-y};returny
The output:
=====> T2783(threaded1) 1 of 1 [0, 0, 0]cd "./rts/T2783.run" && "/home/alp/ghc/inplace/test spaces/ghc-stage2" -o T2783 T2783.hs -dcore-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -dno-debug-output -threaded -debug cd "./rts/T2783.run" && ./T2783 Wrong exit code for T2783(threaded1)(expected 1 , actual 134 )Stderr ( T2783 ):T2783: internal error: ASSERTION FAILED: file rts/ThreadPaused.c, line 314 (GHC version 8.5.20180306 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabugAborted (core dumped)*** unexpected failure for T2783(threaded1)
The code for the corresponding assertion:
// We should never have made it here in the event of blackholes that// we already own; they should have been marked when we blackholed// them and consequently we should have stopped our stack walk// above.ASSERT(!((bh_info==&stg_BLACKHOLE_info)&&(((StgInd*)bh)->indirectee==(StgClosure*)tso)));