Ticket #2786 (new bug)

Opened 5 years ago

Last modified 7 months ago

Blackhole loops are not detected and reported in GHCi

Reported by: simonmar Owned by:
Priority: normal Milestone: _|_
Component: GHCi Version: 6.8.3
Keywords: Cc: patrick@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

While looking into #2783 I noticed this. It has never worked, and I was vaguely aware of it, but it seems we don't have a ticket.

let x = x in x

in GHCi should report <<loop>>. One issue is that the interruptTargetThread global var points to the ThreadId running the expression, which will keep it alive and prevent it from being detected as deadlocked. But that's not all: I think the expression itself is being retained by the main thread (perhaps because it is bound to it), which will cause the child thread to also stay alive.

Change History

Changed 3 years ago by simonmar

  • failure set to None/Unknown

This also means that Template Haskell computations don't catch black holes: #4324

Changed 13 months ago by marlowsd@…

commit 206c8fc3ebd64c40ae09742fdea09ffd0f915d5c

Author: Simon Marlow <marlowsd@gmail.com>
Date:   Thu Apr 12 11:21:02 2012 +0100

    Allow threads in GHCi to receive BlockedIndefintely* exceptions (#2786)
    
    This is a partial fix for #2786.  It seems we still don't get
    NonTermination exceptions for interpreted computations, but we do now
    get the BlockedIndefinitely family.

 compiler/main/InteractiveEval.hs |    4 +-
 compiler/utils/Panic.lhs         |   55 +++++++++++++++++++++++++++++++------
 2 files changed, 48 insertions(+), 11 deletions(-)

Changed 7 months ago by parcs

  • cc patrick@… added

Changed 7 months ago by simonmar

I looked into this a bit today. One problem is that now GHCi is dynamically linked, we always retain all CAFs (because we set keepCAFs to true). This means that any loop that goes through a CAF won't be detected as a black hole, because the CAF is inherently live.

I suspect this isn't the only reason that we don't get blackhole exceptions in GHC, though.

Note: See TracTickets for help on using tickets.