mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 22:01:29 +00:00
Merge pull request #3472 from sangheee/develop
fix: negative WaitGroup counter has not been resolved yet.
This commit is contained in:
commit
80aabdd372
@ -28,12 +28,11 @@ func (c *graceConn) Close() (err error) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
c.m.Lock()
|
c.m.Lock()
|
||||||
|
defer c.m.Unlock()
|
||||||
if c.closed {
|
if c.closed {
|
||||||
c.m.Unlock()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.server.wg.Done()
|
c.server.wg.Done()
|
||||||
c.closed = true
|
c.closed = true
|
||||||
c.m.Unlock()
|
|
||||||
return c.Conn.Close()
|
return c.Conn.Close()
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,11 @@ type Server struct {
|
|||||||
// creating a new service goroutine for each.
|
// creating a new service goroutine for each.
|
||||||
// The service goroutines read requests and then call srv.Handler to reply to them.
|
// The service goroutines read requests and then call srv.Handler to reply to them.
|
||||||
func (srv *Server) Serve() (err error) {
|
func (srv *Server) Serve() (err error) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Println("wait group counter is negative", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
srv.state = StateRunning
|
srv.state = StateRunning
|
||||||
err = srv.Server.Serve(srv.GraceListener)
|
err = srv.Server.Serve(srv.GraceListener)
|
||||||
log.Println(syscall.Getpid(), "Waiting for connections to finish...")
|
log.Println(syscall.Getpid(), "Waiting for connections to finish...")
|
||||||
|
Loading…
Reference in New Issue
Block a user