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

Use atomic to avoid stale SRTP protection profile #595

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

boks1971
Copy link
Contributor

state is acccessed without lock in the FSM.
In some cases, that leads to stale values.
For example, srtpProtectionProfile is set in flight handlers (differnt flight handlers in client and server). But, when it is accessed via the API
SelectedSRTPProtectionProfile,
it gets a stale value as it appears that the two goroutines are out-of-sync on that piece of shared memory.

This is a larger concern for use of state.
Ideally, either

  • state should have a lock internally and all fields are accessed through methods.
  • carefully split fields of state to ensure process access/sync.

Doing the smaller change here to address one field that has seen stale value.

`state` is acccessed without lock in the FSM.
In some cases, that leads to stale values.
For example, `srtpProtectionProfile` is set in flight
handlers (differnt flight handlers in client and server).
But, when it is accessed via the API
`SelectedSRTPProtectionProfile`,
it gets a stale value as it appears that the two goroutines
are out-of-sync on that piece of shared memory.

This is a larger concern for use of `state`.
Ideally, either
- `state` should have a lock internally and all fields are accessed
  through methods.
- carefully split fields of `state` to ensure process access/sync.

Doing the smaller change here to address one field that has
seen stale value.
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

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

Comparison is base (9cc3df9) 77.66% compared to head (a39284c) 77.71%.

Files Patch % Lines
flight4bhandler.go 0.00% 1 Missing and 1 partial ⚠️
flight3handler.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #595      +/-   ##
==========================================
+ Coverage   77.66%   77.71%   +0.04%     
==========================================
  Files         101      101              
  Lines        6430     6435       +5     
==========================================
+ Hits         4994     5001       +7     
+ Misses       1060     1057       -3     
- Partials      376      377       +1     
Flag Coverage Δ
go 77.73% <84.21%> (+0.04%) ⬆️
wasm 63.05% <84.21%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@cnderrauber cnderrauber left a comment

Choose a reason for hiding this comment

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

Greate finding!!

@boks1971 boks1971 merged commit a8f7062 into master Nov 15, 2023
17 checks passed
@boks1971 boks1971 deleted the raja_atomic_srtp_protection_profile branch November 15, 2023 04:55
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.

2 participants