Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


connection pool tries to reuse closed connections #14

hsenag opened this Issue · 3 comments

3 participants


If a webserver doesn't implement keep-alive (e.g. httpd-shed as currently used in the test harness), HTTP doesn't notice and still tries to send a second request on the same connection.


I'm getting a similar error, but instead of throwing ErrorReset or ErrorClosed, we just get the underlying socket error.

The client has sent a PUT request to the server. Here's the client log from the point where we get the response, and then try to send the next PUT request:

Debug: Received:
HTTP/1.1 204 No Content 
Connection: close
Content-Type: text/plain
Date: Fri, 28 Sep 2012 15:59:57 GMT
Server: Happstack/7.0.4

Debug: Sending:
PUT /user/foobar HTTP/1.1
Host: localhost:8080
User-Agent: hackage-import/0.2
Content-Length: 13
Content-Type: text/plain

Debug: Recovering connection to admin:admin@localhost:8080
hackage-import: <socket: 4>: resource vanished

The important thing to notice here is that the server is responding with Connection: close (and presumably then does actually close the socket).


BTW, that's with HTTP-4000.2.5


This issue also seems to be the cause of bug in cabal-install which crashes (for me) when using a proxy.

@statusfailed statusfailed referenced this issue in haskell/cabal

cabal update fails with http_proxy #1602

@hsenag hsenag closed this issue from a commit
@ian-ross ian-ross Fix #14: connection pool tries to reuse closed connections
If a reply contains a "Connection: close" header, the connection is
closed and removed from the connection pool.  This fixes the problem
where HTTP tried to reuse connections that had been closed at the
server end, leading to "broken pipe" errors.
@hsenag hsenag closed this in 69d57a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.