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

Fixed concurrency bug that could be triggered via the React Native plugin #1679

Merged
merged 2 commits into from
May 11, 2022

Conversation

kstenerud
Copy link
Contributor

@kstenerud kstenerud commented May 6, 2022

Goal

DeviceDataCollector.generateDevice makes a clone of its internal runtimeVersions map, which can also be modified by calling addRuntimeVersionInfo. This can cause a concurrency exception in some cases.

Design

Switched to a copy-on-write approach to sidestep the issue.

Testing

New unit test to verify that the new code is concurrency-safe.

@kstenerud kstenerud changed the title Fixed concurrency bug that could be triggered via the React Native pl… Fixed concurrency bug that could be triggered via the React Native plugin May 6, 2022
@kstenerud kstenerud requested a review from lemnik May 6, 2022 12:07
@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 0.0 0.0
arm64_v8a 0.0 0.0
armeabi_v7a 0.0 0.0
x86 0.0 0.0
x86_64 0.0 0.0

Generated by 🚫 Danger

@lemnik
Copy link
Contributor

lemnik commented May 10, 2022

I'm not convinced that we should be opening up our classes just to satisfy Mockito limitations.

We should rather look at:

  • The kotlin-allopen gradle plugin
  • Upgrading Mockito to a version that supports mocking final Android classes (this will have a knock-on effect to our min Android version support)
  • Avoiding the need for mocks in this test (I doubt this is realistic)

For now I'd also be willing to drop the unit test if it proves too invasive.

@kstenerud
Copy link
Contributor Author

Alright, I'm leaving the test code there (commented out) because it's a pain to write. Once we can figure out a better solution we can enable it again.

Copy link
Contributor

@lemnik lemnik left a comment

Choose a reason for hiding this comment

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

LGTM

@kstenerud kstenerud merged commit 9e1da59 into next May 11, 2022
@kstenerud kstenerud deleted the PLAT-8390-concurrency branch May 11, 2022 08:54
@lemnik lemnik mentioned this pull request May 11, 2022
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.

3 participants