OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
493 stars 262 forks source link

[Bug] Add Dispatch Queues to all executors #1454

Closed nan-li closed 2 months ago

nan-li commented 3 months ago

Description

One Line Summary

Improve synchronization in the remaining executors (Identity, Subscription, User) to prevent concurrent access crashes.

Details

In #1376, a DispatchQueue was added to the Operation Repo and the Property Executor to serialize access to shared data. These two components encounter the most updates and frequent mutations by different threads. Though rare, the other executors can also encounter concurrent access.

The changes for the Operation Repo and Property Executor appear to be mitigating crashes, so we are adding the same to all executors in this PR:

Motivation

We received a report of a crash that I believe is due to one of these remaining executors experiencing a concurrent state access / mutation.

Scope

Executors synchronize array access, mutation, and caching through a Dispatch Queue.

Testing

Unit testing

Manual testing

Unable to reproduce

Affected code checklist

Checklist

Overview

Testing

Final pass


This change is Reviewable

nan-li commented 3 months ago

The core changes are ready for review... I am trying to fix flaky tests here but those can be moved to a different PR.