You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I run example (go 1.7.1) and I run: while curl http://127.0.0.1:8080 ; do date; done
Then, I see:
Serving HTTP
^CGot signal:interrupt
Stopping listener
Waiting on server
(expected)
...
Hello HTTP!
Fri Oct 28 21:44:54 UTC 2016
Hello HTTP!
Fri Oct 28 21:44:54 UTC 2016
curl: (52) Empty reply from server
Which means the already accepted connection was interrupted mid-stream.
Looking into the bowels of net/http, it seems somewhat impossible because go c.serve(ctx) has no way of waiting on in-flight requests. There are a few issues open currently to try and fix this issue though:
The intent of this package is stop the listening socket. The handling of any other sockets that have been opened as a result of that one is not in the scope of this package. I choose to solve this problem outside of the application layer, namely by using connection draining on a load balancer before issuing the stop command to my software.
Pull requests that add additional logic and tests to handle such cases are welcome.
If I run example (go 1.7.1) and I run:
while curl http://127.0.0.1:8080 ; do date; done
Then, I see:
(expected)
Which means the already accepted connection was interrupted mid-stream.
Looking into the bowels of net/http, it seems somewhat impossible because
go c.serve(ctx)
has no way of waiting on in-flight requests. There are a few issues open currently to try and fix this issue though:golang/go#4674
golang/go#11219
The problem is that you can't just wait on http.Serve().
The text was updated successfully, but these errors were encountered: