stdout handle is finalized
Daan Leijen
daan at cs.uu.nl
Thu Nov 25 07:42:59 EST 2004
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 ???
I hope this helps,
-- Daan Leijen.
>
> Anyone any idea for a workaround?
>
> All the best,
> Daan Leijen.
>
> (ps. I am not on this list, so please cc)
>
More information about the Glasgow-haskell-bugs
mailing list