We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
go version
Go master HEAD 8d0c105
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="" GORACE="" GOROOT="/usr/lib/go" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GO15VENDOREXPERIMENT="1" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0" CXX="g++" CGO_ENABLED="1"
package main import ( "log" "fmt" "time" "net" "net/http" ) type server3 struct { http.Server } func (s *server3) Serve(l net.Listener) error { fmt.Println("Serving") time.Sleep(time.Second) return s.Server.Serve(l) } // naming is a bitch func (s *server3) Shutdown() { fmt.Println("Closing") s.Close() } func main() { srv := &server3{} srvEnd := make(chan error) for { l, err := net.Listen("tcp","") if err != nil { log.Fatal(err) } go func() { err := srv.Serve(l) srvEnd <- err }() time.Sleep(time.Second) srv.Shutdown() fmt.Println("Close done") err = <- srvEnd fmt.Println(err) } }
Serving Closing Close done ^C
Serving Closing ^C
The text was updated successfully, but these errors were encountered:
$ git diff diff --git a/src/net/http/server.go b/src/net/http/server.go index 0959ac6..d78fd71 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -2362,7 +2362,7 @@ func (s *Server) closeDoneChanLocked() { // regardless of their state. For a graceful shutdown, use Shutdown. func (s *Server) Close() error { s.mu.Lock() - defer s.mu.Lock() + defer s.mu.Unlock() s.closeDoneChanLocked() err := s.closeListenersLocked() for c := range s.activeConn {
Sorry, something went wrong.
That's a very wordy bug report. Thanks to @peter-mogensen for summarizing.
CL https://golang.org/cl/33026 mentions this issue.
8cd5561
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?Go master HEAD 8d0c105
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
What did you do?
What did you expect to see?
Serving
Closing
Close done
^C
What did you see instead?
Serving
Closing
^C
The text was updated successfully, but these errors were encountered: