awslabs / amazon-kinesis-video-streams-pic

Apache License 2.0
49 stars 47 forks source link

unlock stream mutex before acquiring the fom mutex to avoid deadlock … #242

Closed hassanctech closed 7 months ago

hassanctech commented 7 months ago

Issue #, if available:

the PutFrame path acquires locks in the following order:

putFrameLock -> frameOrderCoordinatorLock -> StreamLock -> ClientLock

The free path acquires lock in the following order:

streamListLock -> StreamLock -> FrameOrderCoordinatorLock

Hence here is a possibility of deadlock

Description of changes:

Unlock the stream lock before acquiring the frame order coordinator lock in the freeStream path in order to maintain a consistent lock acquisition order and avoid a deadlock.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov-commenter commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (07dea9e) 80.36% compared to head (1ceffb8) 80.37%.

:exclamation: Current head 1ceffb8 differs from pull request most recent head 6a5e0d6. Consider uploading reports for the commit 6a5e0d6 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #242 +/- ## ======================================== Coverage 80.36% 80.37% ======================================== Files 53 53 Lines 10804 10806 +2 ======================================== + Hits 8683 8685 +2 Misses 2121 2121 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.