This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 247
Fix non-thread-safe mutex access #141
Open
IanHoar
wants to merge
2
commits into
tidwall:master
Choose a base branch
from
IanHoar:ianhoar/mutex_warnings
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When running SwiftWebSocket with the Thread Sanitizer, we noticed that there was a swift race condition when accessing the Manager's, or InnerWebSocket's mutex. Suspecting that this was simply a bug with the Thread Sanitizer we filed a Radar with Apple. Their response was this was actually a true positive and directed us to this article: http://www.russbishop.net/the-law. Because Swifts `&` might allow for mutation on multiple threads, we need to allocate our own memory for the mutex to avoid a heap corruption.
mjarvis
reviewed
Apr 11, 2019
Will this fix make it to the release? |
Works fine for me, ran into the same issue. |
👍 confirmed this fixed an issue seen in the thread sanitizer |
moozzyk
added a commit
to moozzyk/SignalR-Client-Swift
that referenced
this pull request
Sep 8, 2019
SwiftWebSocket has a threading issue described in #37 (comment). There is a PR in the SwiftWebSocket (tidwall/SwiftWebSocket#141) repo to fix the problem but it does not seem like it is going to be merged anytime soon so applying the fix locally. A nice post describing the problem: http://www.russbishop.net/the-law
aforge
pushed a commit
to tinode/ios
that referenced
this pull request
Oct 30, 2019
andriimakukha
added a commit
to mojio/SwiftWebSocket
that referenced
this pull request
Dec 11, 2019
When running SwiftWebSocket with the Thread Sanitizer, we noticed that there was a swift race condition when accessing the Manager's, or InnerWebSocket's mutex. Suspecting that this was simply a bug with the Thread Sanitizer we filed a Radar with Apple. Their response was this was actually a true positive and directed us to this article: http://www.russbishop.net/the-law. Because Swifts `&` might allow for mutation on multiple threads, we need to allocate our own memory for the mutex to avoid a heap corruption. tidwall/SwiftWebSocket PR#tidwall#141 IanHoar/SwiftWebSocket PR#1
nosnilmot
added a commit
to nosnilmot/ndt7-client-ios
that referenced
this pull request
Feb 14, 2023
Apply thread-safety fixes from tidwall/SwiftWebSocket#141 to embedded copy of SwiftWebSocket
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running SwiftWebSocket with the Thread Sanitizer, we noticed that there was a swift race condition when accessing the Manager's, or InnerWebSocket's mutex. Suspecting that this was simply a bug with the Thread Sanitizer we filed a Radar with Apple. Their response was this was actually a true positive and directed us to this article: http://www.russbishop.net/the-law.
Because Swifts
&
might allow for mutation on multiple threads, we need to allocate our own memory for the mutex to avoid a heap corruption.