net/http: SIGKILL, SIGABRT appear to cause server termination yet zombie processes with address still bound persist #16599
Comments
I'm pretty sure this is a generic tcp stack wat. Listening addresses can go On Thu, 4 Aug 2016, 19:04 Emmanuel T Odeke notifications@github.com wrote:
|
The pid you see belongs to the You'll get the behavior you want if you compile your program once with |
Thank you @rhysh for the analysis. Makes sense, and since SIGKILL nor SIGSTOP cannot be stopped, we don't have a way for go run to catch this signal and then kill its children. $ lsof -i :4567 | awk '{ print $2 }'
$ # Then find the PID and kill it with -9 e.g
$ lsof -i :4321 | awk '{ print $2 }' | awk 'if ($2 ~ /[0-9 { print $1 }' | while read F;do kill -9 $F;done Unless @bradfitz or @ianlancetaylor think something else can be done, then this is working as intended. |
Well, definitely not a net/http bug as the subject implies. But as the net/http owner I will happily push "close". :-) |
Please answer these questions before submitting your issue. Thanks!
go version
)?go env
)?GOARCH="amd64"
GOBIN="/Users/emmanuelodeke/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/emmanuelodeke/go"
GORACE=""
GOROOT="/Users/emmanuelodeke/go/src/go.googlesource.com/go"
GOTOOLDIR="/Users/emmanuelodeke/go/src/go.googlesource.com/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v3/7z434qpx5v3bw0wh8h2myfpw0000gn/T/go-build464848761=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1
Ran a simple server. Sent it a SIGKILL, SIGABRT to the program and it exited. However, the socket stays bound to the address of the "killed" server hence any future reuses of the same port/address are impossible.
You can also try with SIGABRT ( kill -6 ) and that produces the same end result in which you can no longer bind to the address when the command is repeated.
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
https://play.golang.org/p/LorluoHyLW
I expected SIGKILL and SIGABRT to shutdown not only the server and unbind itself from the port just like SIGINT would. If this is acceptable behavior, I haven't found any documentation for it in net/http.
When https://play.golang.org/p/LorluoHyLW is rerun, it gives such an error
2016/08/04 01:42:06 listen tcp :4567: bind: address already in use
The issue exists on Go1.6 so this isn't a regression.
The text was updated successfully, but these errors were encountered: