Skip to content
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

Correct crashing issue caused by locking on a object which is replaced inside the lock #220

Merged
merged 1 commit into from
Oct 12, 2016

Conversation

danielevans
Copy link
Contributor

@danielevans danielevans commented Oct 11, 2016

Since the MQTT Session Manager is using @synchronized(self.effectiveSubscriptions) to coordinate updates to the subscriptions but in each case is also replacing the self.effectiveSubscriptions object rather than updating it in place a window exists where two threads may obtain locks on different objects despite the fact that both of them are attempting to manipulate the same reference.

In our case, this appears to be causing BAD_ACCESS crashes as multiple threads attempt to deallocate the same object.

Replacing the @synchronized with an explicit use of a separate NSLock object which is not replaced appears to prevent those crashes.

@ckrey ckrey merged commit 0f00042 into novastone-media:master Oct 12, 2016
@ckrey
Copy link
Contributor

ckrey commented Oct 12, 2016

Thanks @danielevans

ckrey pushed a commit that referenced this pull request Jan 4, 2017
> Release date 2017-01-04

[NEW] Support voip applications #243
[NEW] Add public emqtt broker to test suite
[NEW] Use signals for synchronouse calls #250
[NEW] Configurable connect-in-foreground behaviour #234

[FIX] CocoaLumberjack related issues. Now on current CocoaLumberjack version
[FIX] Documentation update #252
[FIX] Backward compatibility issue #253
[FIX] Publish messages by messageId ascending order when using MQTTInMemoryPersistence #247
[FIX] Adds connectInForeground configuration parameter #223
[FIX] Correct crashing issue caused by locking on a object which is replaced inside the lock #220
[FIX] Use an NSLock instead of locking on an object that is often replaced
[FIX] Adding MQTTSessionManager.h to the umbrella header #213
[FIX] sharing the scheme to make the project carthage compatible #198
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