I was looking at the new tunnels from #346 and found a goroutine leak in internal/sambox/mesh.go. The problem is with how singleConnListener handles disconnects. When the underlying net.Pipe drops, that closure never triggers the listener's Close() method. This means http.Server.Serve just hangs forever on Accept waiting for <-l.closed, which basically leaks a goroutine on every single disconnect.
Here:
func (l *singleConnListener) Accept() (net.Conn, error) {
var conn net.Conn
l.accept.Do(func() { conn = l.conn })
if conn != nil {
return conn, nil
}
<-l.closed
return nil, net.ErrClosed
}
I was looking at the new tunnels from #346 and found a goroutine leak in
internal/sambox/mesh.go. The problem is with howsingleConnListenerhandles disconnects. When the underlying net.Pipe drops, that closure never triggers the listener's Close() method. This means http.Server.Serve just hangs forever on Accept waiting for <-l.closed, which basically leaks a goroutine on every single disconnect.Here: