You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[kyo-net] ConnectionPool: linearize release against close so a raced release cannot orphan a connection
release() and close() were not linearizable on the per-host ring. A connection
returned by release at the same instant as close could land in a ring close had
already drained, or in a fresh HostPool getPool re-created after close cleared
the map. Nothing drains that ring again, so the connection never reaches the
discard callback and its socket stays open with its read armed. On the shared
io_uring transport this surfaced as a flaky end-of-run fd leak (pendingCloses=0)
in the kyo-sql container suites.
release now re-reads closed after publishing and drains-and-discards its HostPool
when the pool closed under it. The HostPool drain, shared by close and the new
drainDiscard, consumes every claimed slot up to tail and spins over a slot that
is mid-publish rather than stopping at it, so a release that claimed a slot but
has not yet stored its sequence is waited for. The ring head CAS keeps disposal
exactly-once across both drainers.
ConnectionPoolTest reproduces the orphan deterministically through a default
no-op test seam and asserts the connection is disposed exactly once, plus a
concurrency smoke that races n releases against one close.
0 commit comments