Nuts,
I am running into an issue, hopefully stemming from me doing something wrong.
I have reproduced/abstracted the issue from a larger app:
http://play.golang.org/p/GkS5iM3y1y
What I would expect, is that 10 goroutines are launched, and after a short while there would be a pool of keepalive'd connections to the localhost web server, and that the http clients would re-use conns from that pool.
What I am seeing instead, is after a short while:
2013/05/27 04:03:24 Err: Get
http://127.0.0.1/: dial tcp
127.0.0.1:80: cannot assign requested address
The box itself indeed appears to be running out of connections. The output of `ss` shows over 55k conns (nearly all in time-wait state).
The local webserver is nginx, with keepalive supported. Go version is "go version go1.1 linux/amd64"
Request response (captured with ngrep):
GET / HTTP/1.1.
Host: 127.0.0.1.
User-Agent: Go 1.1 package http.
Accept-Encoding: gzip.
Server: nginx.
Date: Mon, 27 May 2013 04:13:00 GMT.
Content-Type: text/html; charset=utf-8.
Content-Length: 61.
Last-Modified: Mon, 27 May 2013 04:12:41 GMT.
Connection: keep-alive.
Accept-Ranges: bytes.
.
<html>
<body>
<div align="center">test</div>
</body>
</html>
What am I missing? Any ideas?
Thanks.