Skip to content

Conversation

@denischilik
Copy link
Contributor

@denischilik denischilik commented Oct 10, 2025

Background

Copy attributes to have different copies in different threads.

We identified a crash caused by a race condition between the background message queue (performing JSON serialization) and the main thread (triggered via MPListenerController).

The issue occurred because the same mutable NSDictionary instance was accessed concurrently from different threads.

What Has Changed

Added [attributes copy] in MPIntegrationAttributes initializer to always store an immutable snapshot of attributes, and created an additional copy in setIntegrationAttributes:forKit: so the listener (main thread) and message queue (background thread) each work with their own independent copies.

Screenshots/Video

  • {Include any screenshots or video demonstrating the new feature or fix, if applicable}

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Additional Notes

  • {Any additional information or context relevant to this PR}

Reference Issue (For employees only. Ignore if you are an outside contributor)

Copy link
Contributor

@nickolas-dimitrakas nickolas-dimitrakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@denischilik denischilik merged commit 3ade748 into main Oct 10, 2025
11 checks passed
@denischilik denischilik deleted the fix/crash-related-race-condition branch October 10, 2025 17:52
@mparticle-automation
Copy link
Contributor

🎉 This PR is included in version 8.40.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants