[Haskell-cafe] Re: GHC 6.7 on Windows / containers-0.1 package?

Simon Marlow simonmarhaskell at gmail.com
Wed Sep 26 08:14:14 EDT 2007


Stefan O'Rear wrote:
> On Wed, Sep 19, 2007 at 10:24:24PM +0100, Neil Mitchell wrote:
>> Hi Peter,
>>
>>>  So I grabbed ghc-6.7.20070824 (=the latest one for Windows I could find)
>>> and the "extra-libs", compiled and installed the GLUT package (which I
>>> needed), but when I compile my library, I get
>>>
>>>      Could not find module `Data.Map':
>>>        it is a member of package containers-0.1, which is hidden
>> All dependencies etc. have changed when going to 6.7/6.8 - you are
>> probably better off using 6.6.1 for now.
>>
>> I also don't think that the debugger will help you track down infinite
>> loop style errors. You might be better off posting the code and asking
>> for help.
> 
> You said 0% CPU.  That's *very* important.  It means that you are using
> the threaded runtime (GHCi?), and that you triggered a blackhole.  You
> should be able to handle this by compiling your program with -prof (do
> *not* use -threaded!), and running with +RTS -xc.  With luck, that will
> give you a backtrace to the infinite loop.

As Stefan said, when the program hangs using 0% CPU, it probably means you 
have a "black hole".  A black hole is a particular kind of infinite loop; 
one that GHC detects.  In this case it has detected that the program is in 
a loop, but it hasn't managed to detect that the loop is a real deadlock - 
if it did, then you'd also get an exception ("<<loop>>").  The failure to 
deliver an exception happens in GHCi for subtle reasons that I've 
forgotten, it might even behave differently in GHC 6.8.1.

The debugger in 6.8.1 can also help to track down loops and deadlocks.  Set 
-fbreak-on-error, run the program using :trace, and hit Control-C when it 
hangs.  Then :history will give you a list of the most recently-visited 
points in your program, so you can step back and inspect the values of 
variables.

Cheers,
	Simon



More information about the Haskell-Cafe mailing list