[Haskell-cafe] Re: Re: A ghc-6.10.1 bug or a feature?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Jan 29 17:35:35 EST 2009


On Thu, 2009-01-29 at 17:37 +0100, Juraj Hercek wrote:
> Duncan Coutts wrote:
> > On Wed, 2009-01-28 at 16:56 +0100, Juraj Hercek wrote:
> >   
> >> Prelude> a <- readFile "/sys/devices/system/cpu/online"
> >> Prelude> length a `seq` a
> >> "^CInterrupted.
> >>     
> >
> > http://hackage.haskell.org/trac/ghc/ticket/2971
> >
> > Files in /proc and /sys are not select()able which messes up ghc's IO
> > system. It's not entirely clear what changed between 6.8 and 6.10 that
> > means we hit this now. (I'd have expected it never to have worked given
> > that ghc has always used non-blocking IO.

> Interesting. It looks like it works when I use non-lazy interface for 
> file reading (withFile "/sys/devices/system/cpu/online" ReadMode 
> hGetLine). Does this non-lazy interface use select too? In other words, 
> is it only a good luck that it works?

Ah but that's doing something quite different. You're only asking for
the first line of input (in a file which presumably is only one line
long). If you did hGetLine in a loop until there was no more input then
you would get the same problem.

So it's not to do with strict/lazy it's checking to see if there is more
data available that is the problem (I think).

Clearly we're not sure exactly what is going on, after all it worked in
6.8 and now doesn't in 6.10 and both use essentially the same strategy
for non-blocking IO.

Duncan



More information about the Haskell-Cafe mailing list