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

High number of crashes caused by ConcurrentModificationException #410

Closed
angelix opened this issue Oct 29, 2024 · 4 comments
Closed

High number of crashes caused by ConcurrentModificationException #410

angelix opened this issue Oct 29, 2024 · 4 comments

Comments

@angelix
Copy link

angelix commented Oct 29, 2024

After updating the countly android sdk we see a significant increase of crashed in google play store.

Current Behavior

Exception java.util.ConcurrentModificationException:
  at java.util.HashMap$HashIterator.nextNode (HashMap.java:1603)
  at java.util.HashMap$EntryIterator.next (HashMap.java:1636)
  at java.util.HashMap$EntryIterator.next (HashMap.java:1634)
  at ly.count.android.sdk.ModuleViews.startStoppedViews (ModuleViews.java:489)
  at ly.count.android.sdk.ModuleViews.onActivityStarted (ModuleViews.java:557)
  at ly.count.android.sdk.Countly.onStartInternal (Countly.java:946)
  at ly.count.android.sdk.Countly$6.onActivityStarted (Countly.java:737)
  at android.app.Application.dispatchActivityStarted (Application.java:416)
  at android.app.Activity.dispatchActivityStarted (Activity.java:1506)
  at android.app.Activity.onStart (Activity.java:2040)
  at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:344)
  at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:251)
  at com.**.**.ui.MainActivity.onStart (MainActivity.kt:367)

Your Environment

@arifBurakDemiray
Copy link
Member

Hello @angelix,

I attempted to reproduce this issue by launching a main activity on a similar setup (Android SDK 35 on a Google Pixel), but no errors occurred during those tests. This might suggest the error arises under specific conditions, such as particular background states, activity transitions, or configurations not present in our testing environment.

Next Steps:
To pinpoint the cause more effectively, could you let us know if there are any specific sequences of actions or user behaviors that seem to trigger this crash?

We've prepared a solution to address the ConcurrentModificationException issue by replacing the regular HashMap with a ConcurrentHashMap in the ModuleViews.startStoppedViews method. This update is designed to improve stability and prevent the error during concurrent access.

The proposed fix is available in Pull Request #411, and we'll keep you updated on its publication. Let us know if you have any questions in the meantime!

Thank you for your help in troubleshooting this!

@arifBurakDemiray
Copy link
Member

Hi @angelix , just checking in to see if you have any updates on the issue you reported—let us know if we can help! I am closing this issue but do not hesitate to open a new issue if issue persist. We are always happy to help. Have a good day!

@angelix
Copy link
Author

angelix commented Nov 12, 2024

Hi @arifBurakDemiray,

Sorry for not replying earlier.
Based on production data the fix in #411 solved the issue.

Thanks

@arifBurakDemiray
Copy link
Member

Hello @angelix, I am happy to hear that 😊. We are always happy to help. Have a good day!

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

No branches or pull requests

2 participants