amazon-kinesis-video-streams-webrtc-sdk-c
amazon-kinesis-video-streams-webrtc-sdk-c copied to clipboard
Fix T-San Data Race Issues
Issue #, if available:
What was changed?
- Corrected thread synchronization to prevent unsafe access to shared variables across threads.
- Added missing resetting of
pConnectionListener->receiveDataRoutinetoINVALID_TID_VALUE. - Fixed
RollingBufferlastIndexrace. - Note: This one only appeared as a T-San warning when I ran the sample myself and connected/disconnected viewer several times - issue did not show when I ran the test suite.
Why was it changed?
- In order to resolve Thread Sanitizer failures.
- The failures are intermittent on the CI tests - re-running several times will eventually yield passing results.
- The failures are consistently present when running locally on macOS with LLDB.
How was it changed?
- Added missing mutex locks around asynchronous accessing of variables.
- Set the
receiveDataRoutinetoINVALID_TID_VALUEwheneverTHREAD_JOINis called on its thread. This was done for theIS_VALID_TID_VALUEcheck to actually be able to check for whetherTHREAD_JOINwas already called on the thread. - Wrapped access to
pRollingBuffer->lastIndexwithin thepRollingBuffer->lock.
What testing was done for the changes?
- Ran the test suite locally on Mac with T-San enabled in Debug mode.
- Let the CI to pass 3 times in a row to check for intermittent issues.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
This is a very old issue. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to open a new one.