Skip to content

net/http: SIGKILL, SIGABRT appear to cause server termination yet zombie processes with address still bound persist #16599

Closed
@odeke-em

Description

@odeke-em

Please answer these questions before submitting your issue. Thanks!

  1. 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
  2. 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
  3. 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.
$ 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

  1. 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.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions