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

Block rtxTimer.stop() until timer routine end #132

Closed
wants to merge 1 commit into from

Conversation

at-wat
Copy link
Member

@at-wat at-wat commented Jul 6, 2020

Fix data race during TestRtxTimer.

Reference issue

Fixes #129

@at-wat at-wat requested review from enobufs and Sean-Der July 6, 2020 03:04
@at-wat at-wat self-assigned this Jul 6, 2020
@at-wat at-wat force-pushed the block-until-timer-routine-end-on-stop branch from f748f23 to 67f414f Compare July 6, 2020 03:25
@codecov
Copy link

codecov bot commented Jul 6, 2020

Codecov Report

Merging #132 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #132      +/-   ##
==========================================
- Coverage   79.02%   79.00%   -0.02%     
==========================================
  Files          43       43              
  Lines        2798     2806       +8     
==========================================
+ Hits         2211     2217       +6     
- Misses        453      454       +1     
- Partials      134      135       +1     
Flag Coverage Δ
#go 79.00% <100.00%> (-0.02%) ⬇️
#wasm 69.99% <100.00%> (+0.08%) ⬆️
Impacted Files Coverage Δ
rtx_timer.go 97.91% <100.00%> (+0.18%) ⬆️
association.go 83.09% <0.00%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbc92ec...3384f55. Read the comment docs.

@enobufs
Copy link
Member

enobufs commented Jul 6, 2020

The build error appears to be complaining about the race on the variable nCbs.
The error log found in #129:

 /home/travis/gopath/src/github.com/pion/sctp/rtx_timer_test.go:206 +0x521

I was able to reproduce the issue and fixed this problem locally by using atomic methods for nCbs. Let me send another PR.

@at-wat
Copy link
Member Author

at-wat commented Jul 6, 2020

@enobufs Yes, accessing nCbs using atomic will also fix the race.

On the other hand, current master branch version has no way to know when the caller can assume that the handler will no longer be called. It may cause another race in real application not only the test code, IMO.

@enobufs
Copy link
Member

enobufs commented Jul 6, 2020

Yes, I see. Looks like you are trying to address another problem and we could file another issue to address it later?
I am actually dealing with a race condition between t3RtxTimer.stop() and t3RtxTimer.start() related to pion/webrtc#1270. Let us get the new PR (#134) I have just submitted out of the way first.

@at-wat at-wat force-pushed the block-until-timer-routine-end-on-stop branch 3 times, most recently from 644f29c to d2579bc Compare July 6, 2020 10:42
Fix potential logical race during TestRtxTimer.
@at-wat at-wat force-pushed the block-until-timer-routine-end-on-stop branch from d2579bc to 3384f55 Compare July 6, 2020 10:48
@at-wat
Copy link
Member Author

at-wat commented Sep 23, 2020

Seems not mandatory.

@at-wat at-wat closed this Sep 23, 2020
@at-wat at-wat deleted the block-until-timer-routine-end-on-stop branch September 23, 2020 07:46
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.

Race found in travis-ci
2 participants