Hannah Schoreter writes:

> I have this problem with a self compiled GHC, checked out with
> -rghc-4-07-branch (which should be 4.08, at most with additional
> commits *on that branch*), checked out about July 18.
> 
> When I compile the program below with the command
>   ghc -syslib net -fvia-C -o main Main.hs
> and then run it with
>   ./main
> the output is this:
> 
> ok
> ok
> main: no threads to run:  infinite loop or deadlock?
> 
> then, the program aborts.
> 
> Why is this? This is a test case reproducing the same problem 
> appearing
> in a bigger program. And there, I really *want* to use hClose 
> to ensure
> that the file descriptor is freed as early as possible, because I want
> to open many file descriptors in short succession or in 
> parallel (using
> forkIO).

This appears to be a bug, but I haven't been able to track it down yet.  It
happens after around 7 connections using our local web server, but this
number varies if you use different buffering schemes on the handle.
However, it is always the same from run to run.  Hmmm.

In the meantime, can I suggest not using hGetContents?  I'm guessing that
hGetLine should be enough for your purposes.

Cheers,
        Simon

Reply via email to