Skip to content

Conversation

@ethouris
Copy link
Collaborator

@ethouris ethouris commented Jul 24, 2025

Changes:

  1. Changed m_GlobControlLock to SharedMutex. Most of the uses are still exclusive, except:
    • locateSocket and other lookup functions - these use SharedLock on it
    • closeAllSockets calls closing function on all sockets first under SharedLock, then runs the loop again this time on ExclusiveLock
  2. Removed locking of m_ControlLock in setListenerState. Instead the exclusive access is ensured through compare_exchange call on m_bListening atomic field with a fallback in case when the "winner" happened to fail setting up the listener.
  3. A fix that should clear out the problem, which in some corner situation has led to a segfault, observed here. The problem isn't proven to be solved this way, but at least a path to an undefined (unwanted) behavior has been blocked

The ThreadSanitizer reports one situation described as "T1: Shared(A), Shared(B)", "T2: Shared(B), Exclusive(A)". According to the analysis this doesn't form a potential deadlock, although ThreadSanitizer reports it as such.

@ethouris ethouris mentioned this pull request Jul 25, 2025
43 tasks
@ethouris ethouris added this to the v1.5.5 milestone Aug 4, 2025
@ethouris ethouris force-pushed the dev-rework-mutex-to-shared branch from d571a74 to aaa467f Compare August 20, 2025 09:14
@ethouris ethouris marked this pull request as ready for review August 20, 2025 09:38
@cl-ment cl-ment self-requested a review August 21, 2025 08:16
@cl-ment cl-ment merged commit d720b8c into Haivision:master Aug 26, 2025
8 of 12 checks passed
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