Closed egorse closed 9 months ago
Seems that func (w *routerMWriter) write(ctx context.Context, msg Msg)
under w.mu.Lock()
when calling ww.SendMsg
and getting error can reap connection which ends up in
func (mw *routerMWriter) rmConn(w *Conn)
which requires already locked mw.mu.Lock()
and locks connection reaper forever.
Then next call to func (sck *socket) scheduleRmConn(c *Conn)
stuck trying to sck.reaperCond.L.Lock()
, i.e. by read error.
Synthetic test hard to make but its enough to have two clients dialed to server and then close those clients. Not even needs 5/10 as in TestConnReaperDeadlock. Then you need to make either multiple runs or artificial delays to ensure sequence in prev message.
Running
while go test -timeout 30s -run ^TestConnReaperDeadlock$; do echo .; done
with v0.16.0 eventually may get test failed by timeoutThe output is next:
go-zeromq/zmq4 v0.16.0 go version 1.21.5