Skip to content

[core][tests] Fixes around DROPREQ and handling the broken links - #3461

Merged
ethouris merged 10 commits into
Haivision:devfrom
ethouris:dev-dev-fix-apply-group-sequences
Nov 30, 2026
Merged

ethouris merged 10 commits into
Haivision:devfrom
ethouris:dev-dev-fix-apply-group-sequences

Conversation

@ethouris

@ethouris ethouris commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change

The DROPREQ message shall never be sent in live mode - this is handled because any peer can send it by any reason, but normally there should be no reason for it. Therefore if it happens to be received, it is still handled with the following premises:

  • If DROPREQ doesn't cause any forgetting of the lost packets, it's simply ignored
  • Otherwise, if TLPKTDROP=on (default), drops are accepted, just like drops by latency timeout
  • Otherwise (if TLPKTDROP=off), if this means to break the contiguous stream, this result in dropping the connection.

(Fixes done by Copilot)

Core fixes

  1. 6fddd31f, DROPREQ NULL crash: a group member has no receive buffer of its own, so the DROPREQ handler dereferenced a null pointer. It now reads the oldest sequence from the group's buffer and only touches a socket buffer when one exists.
  2. 7cef309e, dead members never removed (api.cpp): setBrokenClosed() set BROKEN and then overwrote it with CLOSED, so broken sockets were never collected while the application kept sending. BROKEN is now set last.
  3. c147c9ca, empty group (group.h): remove() regenerated the scheduled sequence when the group became empty. A replacement link then ended up in a different sequence domain and delivery stalled. The sequence is now kept.
  4. f770d1b7, DROPREQ semantics: applies only with TSBPD on and TLPKTDROP off.
    • Range check: if the range covers any still-missing packet, the connection breaks. This uses the new CRcvBuffer::hasMissingInRange for a plain socket, or CUDTGroup::hasMissingInRange against the group buffer for a member.
    • Otherwise: the request is ignored.
    • Docs: SRTO_TLPKTDROP in API-socket-options.md describes the behavior.

Tests

  • bd7f4fef: Bonding.JoinRunningGroupSequence.
  • f847af73: Bonding.BackupFailoverNoLoss.
  • f5c11fe7: Bonding.BackupLastLinkReplaced.
  • c147c9ca: also adds Bonding.BackupLastLinkReplacedEmptyGroup (and the BackupLastLinkReplacedImpl helper).
  • 0a554feb: moves LinkBreaker, a UDP relay that can cut a link on demand, into test_env.h with usage documentation.
  • f770d1b7: also adds the buffer unit test CRcvBufferReadMsg.MissingInRange.

The tests I ran passed: all 16 Bonding.* plus CRcvBufferReadMsg.*. The only test for the DROPREQ change is the MissingInRange buffer unit test, so the break path itself is not tested end to end.

ethouris-hv and others added 4 commits November 27, 2026 16:53
…roup members

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…g group

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@ethouris ethouris added this to the v1.6.0 milestone Nov 28, 2026
@ethouris ethouris added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core labels Nov 28, 2026
ethouris-hv and others added 2 commits November 28, 2026 14:14
… without loss

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…he last one broke

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Nov 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.36%. Comparing base (679f83a) to head (be34585).
⚠️ Report is 407 commits behind head on dev.

Files with missing lines Patch % Lines
test/test_main.cpp 83.78% 3 Missing and 3 partials ⚠️
test/test_bonding.cpp 96.77% 0 Missing and 2 partials ⚠️
test/test_env.h 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              dev    #3461       +/-   ##
===========================================
- Coverage   71.12%   59.36%   -11.76%     
===========================================
  Files         101      120       +19     
  Lines       19776    28594     +8818     
  Branches        0     4341     +4341     
===========================================
+ Hits        14065    16976     +2911     
- Misses       5711     9929     +4218     
- Partials        0     1689     +1689     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ethouris-hv and others added 4 commits November 30, 2026 08:49
CUDTSocket::setBrokenClosed() set SSS_BROKEN and then called setClosed(),
which overwrote it with SSS_CLOSED. checkBrokenSockets() collects only
BROKEN sockets, so such sockets were never removed from their group
as long as the application kept the group in use.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The peer group may still be alive and expecting the same sequence
domain, and the group sender buffer still holds packets in it.
Regenerating the sequence caused the new member's stream to be in
a different domain than the receiver, which stalled the delivery.
Added a test for a new link attached to a group with no members.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… off

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@ethouris ethouris changed the title [core] Fix apply group sequences [core][tests] Fixes around DROPREQ and handling the broken links Nov 30, 2026
@ethouris
ethouris merged commit 2de7dc2 into Haivision:dev Nov 30, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants