Skip to content

Avoid stuck disconnect - #2197

Merged
pedroSG94 merged 2 commits into
masterfrom
avoid-stuck-disconnect
Sep 11, 2026
Merged

Avoid stuck disconnect#2197
pedroSG94 merged 2 commits into
masterfrom
avoid-stuck-disconnect

Conversation

@pedroSG94

Copy link
Copy Markdown
Owner

No description provided.

Roman Herbstmann and others added 2 commits September 10, 2026 23:16
With TCP backpressure (server ACKs not arriving, send window full) the sender
blocks in a java.io socket write, which ignores coroutine cancellation.
disconnect() stopped the sender first (BaseSender.stop -> job.cancelAndJoin)
and closed the socket only afterwards, so the join waited until the network
recovered or TCP gave up. A reConnect hung for the whole time.

Try a cooperative stop first (keeps the graceful close in the normal case) and,
if the sender does not stop within 1 s, close the socket to unblock the write
and stop again. RTSP over TCP (interleaved) writes to the same socket and has
the same issue. SRT/UDP are not affected (UDP sends do not block on ACKs).
@pedroSG94
pedroSG94 merged commit 620d05f into master Sep 11, 2026
1 check passed
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