
Hello, I have reported this problem to the maintainer of the HTTP
package about 2 weeks ago, but have not yet received a response, so I
am reporting it here.
I am using a recent git check out of HTTP 4000.0.10
The bufferReadLine function from Network.TCP has a bug in how it
handles an IOException after it catches one. It checks for isEOFError
e, and that branch of code seems to be ok. The problem is how it
handles other types of IO errors. One type of such an error, for
example, is:

After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159 For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected. Claus

On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159
For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected.
This looks like the problem. Any idea how to get the HTTP package fixed? I could try making a patch myself, but I would prefer hearing from the HTTP maintainer first, who doesn't seem to be around. Bit Connor

Bit Connor wrote:
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
wrote: After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159
For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected.
This looks like the problem. Any idea how to get the HTTP package fixed? I could try making a patch myself, but I would prefer hearing from the HTTP maintainer first, who doesn't seem to be around.
I've tried contacting him a few times about getting the base dependencies in HTTP bumped and an upload made, without success. This is a widely used package that's in the platform and that won't work with GHC 7.0 with the current dependencies, so it really needs to get fixed soon. libraries@, what's the right way to proceed? Can I make a Debian-style "non-maintainer upload" with minimal changes to fix urgent issues like these? Cheers, Ganesh =============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ===============================================================================

On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh < ganesh.sittampalam@credit-suisse.com> wrote:
Bit Connor wrote:
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
wrote: After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159
For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected.
This looks like the problem. Any idea how to get the HTTP package fixed? I could try making a patch myself, but I would prefer hearing from the HTTP maintainer first, who doesn't seem to be around.
I've tried contacting him a few times about getting the base dependencies in
HTTP bumped and an upload made, without success. This is a widely used package that's in the platform and that won't work with GHC 7.0 with the current dependencies, so it really needs to get fixed soon.
libraries@, what's the right way to proceed? Can I make a Debian-style "non-maintainer upload" with minimal changes to fix urgent issues like these?
I'd be much obliged if you could, and I do apologise for leaving all of this just hanging. No time available for Haskell projects these days unfortunately, Opera engine development taking up most of my waking hours. Getting someone to take over HTTP would be best, or maybe rewrite it altogether..it is not the prettiest thing around :) --sigbjorn

On Fri, Oct 22, 2010 at 11:36 AM, Sigbjorn Finne
On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh
wrote: Bit Connor wrote:
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
wrote: After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159
For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected.
This looks like the problem. Any idea how to get the HTTP package fixed? I could try making a patch myself, but I would prefer hearing from the HTTP maintainer first, who doesn't seem to be around.
I've tried contacting him a few times about getting the base dependencies in HTTP bumped and an upload made, without success. This is a widely used package that's in the platform and that won't work with GHC 7.0 with the current dependencies, so it really needs to get fixed soon.
libraries@, what's the right way to proceed? Can I make a Debian-style "non-maintainer upload" with minimal changes to fix urgent issues like these?
I'd be much obliged if you could, and I do apologise for leaving all of this just hanging. No time available for Haskell projects these days unfortunately, Opera engine development taking up most of my waking hours. Getting someone to take over HTTP would be best, or maybe rewrite it altogether..it is not the prettiest thing around :)
I know it may not be appropriate as-is due to its dependency list, but http-enumerator[1] may be something to consider. It's still young, but I think the API is pretty clean, and I've heard from users that it performs favorably versus HTTP. Michael [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/http-enumerator

On Fri, 22 Oct 2010, Sigbjorn Finne wrote:
On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh < ganesh.sittampalam@credit-suisse.com> wrote:
libraries@, what's the right way to proceed? Can I make a Debian-style "non-maintainer upload" with minimal changes to fix urgent issues like these?
I'd be much obliged if you could, and I do apologise for leaving all of this just hanging.
I've just done this. Thanks for the blessing. 4000.0.10 should fix the reported issue with fail and Either, and bumps the base dep to build with GHC 7.0
No time available for Haskell projects these days unfortunately, Opera engine development taking up most of my waking hours. Getting someone to take over HTTP would be best, or maybe rewrite it altogether..it is not the prettiest thing around :)
I'm not particularly keen on taking over maintainership, but I guess if noone else wants it I could take it over and do at least minimal updates like this. Any other volunteers? Cheers, Ganesh

On 29/10/2010 23:24, Ganesh Sittampalam wrote:
On Fri, 22 Oct 2010, Sigbjorn Finne wrote:
On Fri, Oct 22, 2010 at 9:35 AM, Sittampalam, Ganesh < ganesh.sittampalam@credit-suisse.com> wrote:
libraries@, what's the right way to proceed? Can I make a Debian-style "non-maintainer upload" with minimal changes to fix urgent issues like these?
I'd be much obliged if you could, and I do apologise for leaving all of this just hanging.
I've just done this. Thanks for the blessing.
4000.0.10 should fix the reported issue with fail and Either, and bumps the base dep to build with GHC 7.0
That's great. Any chance you could also look at this one, which appears to be a pretty serious bug for some people, and has a patch? http://hackage.haskell.org/trac/ghc/ticket/4251 Cheers, Simon

On Wed, 3 Nov 2010, Simon Marlow wrote:
On 29/10/2010 23:24, Ganesh Sittampalam wrote:
4000.0.10 should fix the reported issue with fail and Either, and bumps the base dep to build with GHC 7.0
That's great. Any chance you could also look at this one, which appears to be a pretty serious bug for some people, and has a patch?
Sure, I'll do it this weekend. Given that the HTTP test suite is pretty minimal, we'll just have to hope for no unintended side-effects though (which also applies to the previous change, of course). Ganesh

Hi Bit, On Thu, 21 Oct 2010, Bit Connor wrote:
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
wrote: After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159
For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected.
This looks like the problem. Any idea how to get the HTTP package fixed? I could try making a patch myself, but I would prefer hearing from the HTTP maintainer first, who doesn't seem to be around.
I'm just looking at fixing this so I can make an upload as discussed with Sigbjorn. I guess the best thing to do is to make all the calls to fail into something more explicit. BTW, can you confirm that you were using GHC 7.0 (or 6.13) when this went wrong? Cheers, Ganesh

On Sat, Oct 23, 2010 at 8:49 PM, Ganesh Sittampalam
Hi Bit,
On Thu, 21 Oct 2010, Bit Connor wrote:
On Sat, Oct 16, 2010 at 10:29 AM, Claus Reinke
wrote: After it catches this error, the function returns (line 376):
return (fail (show e))
The "fail" is running in the Either monad (The Result type = Either). This calls the default Monad implementation of fail, which is just a call to plain old error. This basically causes the entire program to crash.
Actually, it appears that simpleHTTP isn't actually supposed to throw an IOException, and it is instead supposed to return a ConnError result. So the real fix is to fix the code to make this happen. But
Sounds like a victim of http://hackage.haskell.org/trac/ghc/ticket/4159
For mtl clients, 'fail' for 'Either' used to call 'Left'. That was changed, though the ticket does not indicate the library versions affected.
This looks like the problem. Any idea how to get the HTTP package fixed? I could try making a patch myself, but I would prefer hearing from the HTTP maintainer first, who doesn't seem to be around.
I'm just looking at fixing this so I can make an upload as discussed with Sigbjorn. I guess the best thing to do is to make all the calls to fail into something more explicit.
Yep. Ideally, simpleHTTP and its friends should never throw an IO exception (and should certainly never call prelude's "error", as happens now). Network errors and other errors should be reported by returning an appropriate ConnError Result: http://hackage.haskell.org/packages/archive/HTTP/4000.0.9/doc/html/Network-S...
BTW, can you confirm that you were using GHC 7.0 (or 6.13) when this went wrong?
Yes, I am using ghc 7.1.20100925 Thanks, Bit Connor

On Sun, 24 Oct 2010, Bit Connor wrote:
On Sat, Oct 23, 2010 at 8:49 PM, Ganesh Sittampalam
wrote: I'm just looking at fixing this so I can make an upload as discussed with Sigbjorn. I guess the best thing to do is to make all the calls to fail into something more explicit.
Yep. Ideally, simpleHTTP and its friends should never throw an IO exception (and should certainly never call prelude's "error", as happens now). Network errors and other errors should be reported by returning an appropriate ConnError Result:
I'm not going to try to audit for that exhaustively right now, but I've changed all the calls to fail that were broken by the Either change, so hopefully we should be back where we started. I've put a repo up with the changes and a base dependency bump at http://urchin.earth.li/git/HTTP - could you (and anyone else interested) give it a try? I haven't done anything but the most minimal testing and in particular I haven't made any effort to reproduce your specific problem. I plan to upload this as HTTP-4000.0.10 in the next few days. Cheers, Ganesh
participants (7)
-
Bit Connor
-
Claus Reinke
-
Ganesh Sittampalam
-
Michael Snoyman
-
Sigbjorn Finne
-
Simon Marlow
-
Sittampalam, Ganesh