ghci crash after exception
Simon Marlow
simonmar at microsoft.com
Fri Aug 20 11:18:02 EDT 2004
On 29 June 2004 00:49, Erkok, Levent wrote:
> I've a read-eval-print loop based program that I've been trying to
> make more robust by catching and responding to any exceptions that
> might be thrown; mainly using Control.Exception.evaluate and
> Control.Exception.catch. However, I noticed that once I catch a
> non-termination type of error and take care of it, ghc throws me a
> "thread blocked indefinitely" message and immediately crashes in the
> next read-eval-print attempt right away. I was trying to come up with
> a small bit of code to demonstrate this when I noticed ghci behaves
> the same:
[ ... snip ... ]
> Loading package base ... linking ... done.
> Prelude> let x=x in x
> *** Exception: <<loop>>
> Prelude> 3
>
> Fail: thread blocked indefinitely
Thanks, that's an interesting bug. I've committed a workaround, but the
underlying cause of the bug still remains: when a thread is found to be
unreachable by the garbage collector, perhaps because it is blocked on
itself or an unreachable MVar, then anything it refers to can be
finalized. Strangely this problem doesn't affect GHCi on Unix, because
the signal handler for ^C keeps the main thread alive and hence
everything it points to...
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list