Closed gopherbot closed 9 years ago
Your svg shows handleConnection calling SetReadDeadline. And indeed, it calls it in a loop:
func handleConnection(conn net.Conn, stopChan chan bool, wg *sync.WaitGroup) {
defer func() {
conn.Close()
wg.Done()
}()
var (
e error
buffer []byte
)
buffer = make([]byte, 16384)
running := true
for running {
e = conn.SetReadDeadline(time.Now().Add(5 * time.Second))
select {
case _, running = <-stopChan:
default:
_, e = conn.Read(buffer)
if e != nil {
if neterr, ok := e.(net.Error); ok && neterr.Timeout() {
continue
} else {
running = false
}
}
}
}
}
If one of them ever times out, neterr.Timeout() will be true and you'll loop forever.
If you can still reproduce with that fixed and Go tip or Go 1.4.2, let us know.
by david.birdsong: