-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Run ops.GracefulClose earlier in pc.Close #2863
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2863 +/- ##
==========================================
- Coverage 78.90% 78.82% -0.09%
==========================================
Files 89 89
Lines 8452 8452
==========================================
- Hits 6669 6662 -7
- Misses 1296 1302 +6
- Partials 487 488 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure of this change. It looks like a stopgap measure where ideally we should be moving all the code in peerconnection.go that does
pc.sctpTransport.lock.Lock()
...
pc.sctpTransport.lock.Unlock()
into sctpTransport and let that object handle the correctness of operations after close.
However, I'm sure it doesn't make anything worse, so it's okay from my side to merge.
Note: we cannot gracefully close datachannels
once sctpTransport.Stop
has been called.
Why can't they be gracefully closed at that point? |
Also I agree but it's a larger change and a little bit more invasive to existing behavior. I'll file an issue! #2867 |
I think I was wrong here. Gracefully closing the datachannel will wait for the readloop to complete, which I guess is the point of graceful close. |
Reverted this. There wasn't an accompanying test that would show this fails easily in a race to start and stop ops. Op queue has no way of canceling in progress ops. |
Without this, it increases the chance of races between resources a PeerConnection owns and operations on the ops queue that affect those resources. For example, a SetRemoteDescription that opens an SCTP stream for a data channel could be running while we close down the peer connection. If there were a bug in the SCTP library that incorrectly performs operations after close, this would be an issue (like in pion/sctp#348).