stdout handle is finalized
Simon Marlow
simonmar at microsoft.com
Tue Nov 30 07:01:15 EST 2004
On 25 November 2004 12:43, Daan Leijen wrote:
> Daan Leijen wrote:
>> I have a rather large program, and
>> suddenly, after no changes related to
>> output, my program "crashes" with the message:
>>
>> Fail: <stdout>: hPutStr: illegal operation (handle is finalized)
>>
>> It does (probably) happen when using "ioError" and "Ex.catch"
>> to catch the exception -- maybe the gc makes a mistake here?
>
> Ok, I have found the problem -- even though I think this is
> still a bug in ghc. What happened:
>
> - an exception was raised with (lazy) error message
> - the catch handler used putStr to print the message
> - the evaluation of the message failed because a pattern
> didn't match
>
> ... so, I guess GHC raised an (pattern match) error again, but somehow
> not the pattern match error, but a Handle error ?!
> Ha, probably, putStr is wrapped itself in an "catch" and
> the handler there doesn't inspect the raised the error
> but always raises a "handle is finalized" message ???
This can happen if your program contains an infinite loop or a deadlock.
It is a bug, but a tough one to fix at the moment.
I'm not aware of any way that this can happen without an infinite loop
or deadlock, so if you have such a case I'd be interested in tracking it
down. Please compile your program with -debug, and run with +RTS -Ds to
get more information on what the scheduler's doing.
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list