Skip to content

fix: create a server transaction outside the transaction store's lock - #370

Closed
fridokus wants to merge 1 commit into
emiago:mainfrom
fridokus:server-tx-lock
Closed

fridokus wants to merge 1 commit into
emiago:mainfrom
fridokus:server-tx-lock

Conversation

@fridokus

Copy link
Copy Markdown

serverTxRequest held the transaction store's write lock across serverTxCreate. Creating a server transaction acquires the connection its responses will use, and when the connection the request arrived on is gone that is a dial to the Via host, which for a peer that went away lasts the whole connect timeout. Every other request in the layer waits on the lock for those ten seconds, times out at its sender, and the senders' now-closed connections make them the next dials. Seen on a proxy carrying ten thousand subscribers: two of four replicas ran that convoy for two hours, 248 goroutines parked on the lock.

The transaction is now created unlocked and inserted under the lock. If a retransmission raced its copy in first, the loser terminates what it created and hands its request to the winner.

Tests: TestTransactionLayerServerTxCreationDoesNotHoldTheStore, TestTransactionLayerRacingCopiesShareOneServerTx.

🤖 Generated with Claude Code

serverTxRequest held the server-transaction store's write lock across
serverTxCreate, and creating a transaction acquires the connection its
responses will ride. When the connection the request arrived on is gone,
that is a dial to the Via host, which to a peer that has gone away lasts
the whole connect timeout — ten seconds under the lock every request in
the layer waits on. The requests queued behind it time out at their
senders, whose closed connections make them the next dials, and the
server side never recovers. Seen on a P-CSCF carrying ten thousand
subscribers: two of four replicas ran that convoy for two hours.

The transaction is now created unlocked and inserted under the lock;
a retransmission that raced its copy in first wins, and the loser
terminates what it created and is received by the winner.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@fridokus

Copy link
Copy Markdown
Author

Duplicate of #366, opened by mistake — same change, same tests. Closing this one.

@fridokus fridokus closed this Sep 18, 2026
@fridokus
fridokus deleted the server-tx-lock branch September 18, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant