logo       

RE: stdout handle is finalized: msg#00044

lang.haskell.glasgow.bugs

Subject: RE: stdout handle is finalized

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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise