[Haskell-cafe] Re: A GHC error message puzzle
gale at sefer.org
Sat Aug 14 17:29:11 EDT 2010
Lennart Augustsson wrote:
>> So it's a bug in the garbage collector. It's closing a handle that
>> clearly is still reachable, otherwise this would not have happened.
Simon Marlow wrote:
> The handle is in fact not reachable from the roots, because the thread that
> points to it is also not reachable.
I think I agree with Lennart here. A thread with an active exception
handler is not permanently unreachable, only temporarily
unreachable, unless we know that it is impossible for any exception
to be thrown at it that it is capable of catching. In this case,
the handler can catch a NonTermination, so it is not unreachable.
A keyboard interrupt is another possibility.
If we know that things are really stuck it could still be helpful for
us to throw the NonTermination, but that doesn't mean that the
handle should be considered unreachable at the time.
It is very important to do the best we can to allow people's
exception handlers to run successfully, especially in a bracket.
That is a much higher priority than protecting people from
hanging their app when they write poor exception handlers.
By finalizing the handle, you are significantly lowering the
chance of exception handlers being able to do a proper job.
I do agree, though, that hClose should be less finicky about finalized
handles, which would solve the problem in this particular case.
More information about the Haskell-Cafe