[Haskell-cafe] hGetLine problem

Michael Walter michael.walter at gmail.com
Thu Dec 9 11:44:16 EST 2004


I'll do so at lunch break/from home tonight.

Thanks,
Michael


On Thu, 9 Dec 2004 16:19:20 +0000, Jules Bean <jules at jellybean.co.uk> wrote:
> 
> On 9 Dec 2004, at 15:30, Michael Walter wrote:
> > I continued toying with my toy web server, and I'm "sometimes" getting
> > "Invalid argument" errors in hGetLine for a handle I retrieved from
> > Network.listenOn.
> >
> 
> My first guess would be that hGetLine would return invalid argument if
> it was called on a handle which represents a file which is now closed.
> However, testing in GHCI suggests that returns "illegal operation
> (handle is closed)". Could be different for network sockets, I suppose.
> 
> 
> 
> > "Sometimes", because it works fine in the browser, except when I
> > reload very frequently -- maybe it's related to some concurrency
> > issues (I'm using forkIO to spawn off the handler process from the
> > main server loop). When I wanted to benchmark the server using "ab"
> > (Apache Benchmark), it didn't even "survive" one request but Fail'ed
> > using that error message - "<handle: n>: hGetLine: Invalid argument".
> >
> > I tried adjusting the buffering mode.
> >
> > Do you have any ideas?
> >
> 
> Sounds like a double-close error or something like that. Hard to say
> without seeing the code. Can you make a minimal example?
> 
> Jules
> 
>


More information about the Haskell-Cafe mailing list