Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fix : Sequence number in the ACK packet isn’t correct (#2873) #2877

Merged
merged 3 commits into from
Feb 16, 2024

Conversation

kura979
Copy link
Contributor

@kura979 kura979 commented Feb 15, 2024

Reset the m_iLargestSeq back to SRT_SEQNO_NONE once the loss list is empty. This way if the next packet loss seqno has a distance more than m_iSeqNoTH from the m_iLargestSeq, it is not ignored and added to the loss list.

Fixes #2873.

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (8b73dbc) 66.99% compared to head (f916578) 66.59%.

❗ Current head f916578 differs from pull request most recent head 62f9e7e. Consider uploading reports for the commit 62f9e7e to get more accurate results

Files Patch % Lines
srtcore/list.cpp 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2877      +/-   ##
==========================================
- Coverage   66.99%   66.59%   -0.40%     
==========================================
  Files         103      103              
  Lines       20460    20464       +4     
==========================================
- Hits        13707    13628      -79     
- Misses       6753     6836      +83     

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

@maxsharabayko maxsharabayko added this to the v1.5.4 milestone Feb 15, 2024
@maxsharabayko maxsharabayko added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core labels Feb 15, 2024
Copy link
Collaborator

@maxsharabayko maxsharabayko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Yoda notation is not used in the project. To be consistent, the typical order should be used.

srtcore/list.cpp Outdated Show resolved Hide resolved
srtcore/list.cpp Outdated Show resolved Hide resolved
kura979 and others added 2 commits February 15, 2024 21:26
Co-authored-by: Maxim Sharabayko <maxlovic@gmail.com>
Co-authored-by: Maxim Sharabayko <maxlovic@gmail.com>
@maxsharabayko maxsharabayko merged commit faefc98 into Haivision:master Feb 16, 2024
9 of 10 checks passed
@gou4shi1
Copy link
Contributor

gou4shi1 commented Feb 19, 2024

I think this PR will re-introduce this bug: #2192 (comment)

@gou4shi1
Copy link
Contributor

gou4shi1 commented Feb 19, 2024

m_iLargestSeq should record history seq, and should not be reset after empty, to fix concurrent issues.

We should find another way to fix your issue "the next packet loss seqno has a distance more than m_iSeqNoTH"

@ethouris
Copy link
Collaborator

In #2527 I have provided various improvements for the receiver buffer. In this solution there's also changed the way of taking the sequence number for ACK, which is no longer taken from the loss list, and it's taken exclusively from the receiver buffer (the ACK actually acknowledges the initial contiguous region in the receiver buffer, which is defined directly in this version). Would you be able to take a look at that?

@maxsharabayko
Copy link
Collaborator

maxsharabayko commented Feb 19, 2024

m_iLargestSeq should record history seq, and should not be reset after empty, to fix concurrent issues.

We should find another way to fix your issue "the next packet loss seqno has a distance more than m_iSeqNoTH"

Just thinking out loud, what if the m_iLargestSeq would be ignored upon inserting to the RCV loss list if the loss list is empty?
As a workaround to resolve both issues until #2527 is merged.

Besides, PR #2527 does not fix the RCV loss list, that does not add the loss seqno in itself.

@ethouris
Copy link
Collaborator

Yes, #2527 doesn't fix the loss list, it simply takes out one of its roles in deciding about ACK. Loss list in here is exclusively used for recording the loss for the need of NAKREPORT and in case of the file CC, also checking the loss level for speed control.

@maxsharabayko
Copy link
Collaborator

@gou4shi1 The bug was that a data packet 899264404 with a gap is inserted into the receiver buffer (899264403 is missing). But before the loss is recorded in the RCV loss list, the TSBPD thread drops the missing packet seqno 899264403.
I am afraid I forgot how does the m_iLargestSeq` fixes the concurrency issue.

The original issue description (#2192 (comment)):

When processData() received 899264404, it was added into the recv buffer, after recvbuf_acklock was unlocked, the tsbpd thread played 899264404 and dropped 899264403, then processData() immediately insert 899264403 back into loss list, after this, getFirstLostSeq() keep return 899264403

@maxsharabayko
Copy link
Collaborator

Please continue the discussion in #2881.

@Haivision Haivision locked and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

[BUG] Sequence number in the ACK packet isn’t correct
4 participants