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

fix: Avoid Crash Report: ConcurrentModificationException #1073

Merged
merged 1 commit into from
Mar 28, 2021

Conversation

lempere
Copy link
Contributor

@lempere lempere commented Sep 20, 2020

Platforms affected

Android

Motivation and Context

Fix #924
We have a project with 31 plugins installed, in some devices like Huawei p30( or emulator Pixel_3-x86_64 android R) fail starting the app 4 of 10 times.
Showing the ConcurrentModificationException error from the webView.postMessage("splashscreen", "hide"); of the SplashScreen.java

Description

Tracking the #924 thread I found a code to avoid the error using .synchronizedMap. This was not enough the app still crash sometimes.
Then testing using the .forEach instead of the for (CordovaPlugin plugin : this.pluginMap.values()) works. No more ConcurrentModificationException were thrown.
A counterpoint is that .forEach is not available prior android 6 and a check version is needed.

Testing

npm run test
Found a device with launch problems. Start the app a lot of times with this pr code, no ConcurrentModificationException happens again.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@erisu erisu changed the title (android) Avoid Crash Report: ConcurrentModificationException fix: Avoid Crash Report: ConcurrentModificationException Mar 26, 2021
@breautek breautek added this to the 9.1.0 milestone Mar 27, 2021
@breautek breautek requested a review from erisu March 27, 2021 13:46
@breautek
Copy link
Contributor

Hi @lempere

We are working towards building a 9.1 release and would like to include this PR, are you able to rebase against current master and solve the merge conflicts?

@codecov-io
Copy link

codecov-io commented Mar 28, 2021

Codecov Report

Merging #1073 (8e9764a) into master (19a5feb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1073   +/-   ##
=======================================
  Coverage   73.30%   73.30%           
=======================================
  Files          22       22           
  Lines        1768     1768           
=======================================
  Hits         1296     1296           
  Misses        472      472           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19a5feb...8e9764a. Read the comment docs.

Copy link
Member

@erisu erisu left a comment

Choose a reason for hiding this comment

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

LGTM

@breautek breautek merged commit f927014 into apache:master Mar 28, 2021
@breautek
Copy link
Contributor

Thank you @lempere for your effort into preparing this PR and contributing to Apache Cordova.

wedgberto pushed a commit to wedgberto/cordova-android that referenced this pull request May 17, 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.

Crash Report: ConcurrentModificationException
4 participants