mParticle / mparticle-apple-sdk

mParticle Apple SDK
Apache License 2.0
46 stars 66 forks source link

fix: Correct threading around user notification log #261

Closed BrandonStalnaker closed 7 months ago

BrandonStalnaker commented 7 months ago

Instructions

  1. PR target branch should be against development
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

    Summary

    • Fix occasion timing crash around log notification
  1. App goes to background for a long time (not killed)
  2. User receives and taps notification
  3. App opens and at the same, concurrently, time attempts to a. on main queue, log user notification with _session property in https://github.com/mParticle/mparticle-apple-sdk/blob/d604e598b74503ff6f675c0989a014a0f266f21d/mParticle-Apple-SDK/MPBackendController.m#L1986 b. on internal message queue, end old session and begin a new one in https://github.com/mParticle/mparticle-apple-sdk/blob/d604e598b74503ff6f675c0989a014a0f266f21d/mParticle-Apple-SDK/MPBackendController.m#L2200

The read on main queue in logUserNotification: method is done without synchronisation, resulting in occasional crashes on notification interactions.

Testing Plan

mparticle-automation commented 7 months ago

:tada: This PR is included in version 8.21.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: