rcrowley / go-tigertonic

A Go framework for building JSON web services inspired by Dropwizard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

accept tcp 127.0.0.1:12345: use of closed network connection

proteneer opened this issue · comments

I'm using the HEAD from master, and getting this error:

accept tcp 127.0.0.1:12345: use of closed network connection

(This is the error returned from Server.ListenAndServe(), and in turn net.Listen())

I'm trying to figure what exactly is trying to use it. Any ideas?

I honestly don't. I've seen it in logs for non-Tiger Tonic services before, too, though, so the problem may be more subtle. Or it may not be a problem at all! ¯_(ツ)_/¯

Can reproduce this using the graceful shutdown in example.go. It is logged during the Close() method.

    go func() {
        var err error
        err = server.ListenAndServe()
        if nil != err {
            log.Println(err)
        }
    }()

    ch := make(chan os.Signal)
    signal.Notify(ch, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGKILL)
    log.Println("Received system signal:", <-ch)
    log.Println("Closing")
    server.Close()
    log.Println("Done closing")

If at least one request has been served before I interrupt it will log the error:

2015/12/04 15:38:05 Received system signal: interrupt
2015/12/04 15:38:05 Closing
2015/12/04 15:38:05 accept tcp 127.0.0.1:8002: use of closed network connection
2015/12/04 15:38:05 Done closing