ghci forgets to close files sometimes
simonmar at microsoft.com
Tue Sep 7 06:13:49 EDT 2004
On 07 September 2004 11:00, Josef Svenningsson wrote:
>>> There seems to me that when ghci fails to load a file it sometimes
>>> fails to close it. The problem seems to be when there is a parse
>>> error in the file.
>>> My setup:
>>> Windows XP running cygwin
>>> ghc version 6.2.1
>> Entirely possible. What are the symptoms? Is there an easy way to
> Alas. I haven't been able to reproduce the behaviour afterwards. It
> seems to be one of those erratic bugs we all hate.
> Anyway, I can give some more details of the scenario when I
> encountered the bug. I use XEmacs to edit my Haskell file. When I
> loaded one particular file into ghci I got a parse error. I went back
> to XEmacs and corrected to error. But when I tried to save the file
> XEmacs said it couldn't because the file was busy. I don't remember
> the exact message though. Going back to ghci and typing `:l' released
> the file and I could save it.
> Well, its not bother me anymore right now. If the problem shows up
> again I'll try and investigate more. Are there any particular things
> that I should be looking for in that case?
I can't see any obvious places where GHC is not closing files. We're
pretty careful not to use lazy I/O, except in one place where we force
the results and close the file eagerly afterward.
If you run into the problem again, inspecting the open files table using
lsof or something would probably be helpful. That would at least
provide proof that it was GHC and not something else holding onto the
More information about the Glasgow-haskell-bugs