Closed
Description
Please answer these questions before submitting your issue. Thanks!
- What version of Go are you using (
go version
)?- go version devel +50edddb Tue Aug 2 21:31:58 2016 +0000 darwin/amd64
- go1.6
- What operating system and processor architecture are you using (
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 - What did you do?
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.
- Steps, run either https://play.golang.org/p/LorluoHyLW or its variation https://play.golang.org/p/GvjCDDwaNf, get the program's PID and then SIGTERM it.
$ go run server.go --port-addr 4567 &
[1] 62314
2016/08/04 01:44:40 serving at :4567
$ kill -9 62314
[1]+ Killed: 9 go run server.go --port-addr 4567
$ go run server.go --port-addr 4567
2016/08/04 01:46:36 serving at :4567
2016/08/04 01:46:36 listen tcp :4567: bind: address already in use
exit status 1
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
- What did you expect to see?
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. - What did you see instead?
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.