Skip to content

Conversation

@antonis
Copy link
Contributor

@antonis antonis commented Jan 27, 2026

Based on #5582

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Fix ConcurrentModificationException when disabling native crash handling

When enableNativeCrashHandling is set to false, the code was iterating over the integrations list with a for-each loop while calling remove() directly, which causes a ConcurrentModificationException at runtime.

Fixed by using Java 8's removeIf() method which safely handles iteration and removal in a single operation. This is more concise and follows modern Java best practices.

Added unit tests to verify the fix and ensure integrations are properly removed without throwing exceptions.

💡 Motivation and Context

See #5582 (comment)

💚 How did you test it?

CI, Manually

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

#skip-changelog

…ve crash handling

When enableNativeCrashHandling is set to false, the code was iterating over
the integrations list with a for-each loop while calling remove() directly,
which causes a ConcurrentModificationException at runtime.

Fixed by using Java 8's removeIf() method which safely handles iteration
and removal in a single operation. This is more concise and follows modern
Java best practices.

Added unit tests to verify the fix and ensure integrations are properly
removed without throwing exceptions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@antonis antonis added ready-to-merge Triggers the full CI test suite and removed ready-to-merge Triggers the full CI test suite labels Jan 27, 2026
@antonis
Copy link
Contributor Author

antonis commented Jan 27, 2026

@sentry review

@antonis antonis marked this pull request as ready for review January 27, 2026 16:47
@github-actions
Copy link
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 410.94 ms 427.89 ms 16.95 ms
Size 43.75 MiB 48.40 MiB 4.65 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
b4df5a0+dirty 405.80 ms 412.56 ms 6.77 ms
88812b1+dirty 428.04 ms 462.22 ms 34.18 ms
82de722+dirty 425.13 ms 457.02 ms 31.89 ms

App size

Revision Plain With Sentry Diff
b4df5a0+dirty 43.75 MiB 48.40 MiB 4.65 MiB
88812b1+dirty 43.75 MiB 48.40 MiB 4.64 MiB
82de722+dirty 43.75 MiB 48.40 MiB 4.64 MiB

@github-actions
Copy link
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 410.20 ms 441.00 ms 30.80 ms
Size 43.94 MiB 49.22 MiB 5.29 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
b4df5a0+dirty 364.57 ms 389.29 ms 24.71 ms
88812b1+dirty 425.90 ms 435.25 ms 9.35 ms
82de722+dirty 398.52 ms 422.70 ms 24.18 ms

App size

Revision Plain With Sentry Diff
b4df5a0+dirty 43.94 MiB 49.22 MiB 5.29 MiB
88812b1+dirty 43.94 MiB 49.22 MiB 5.29 MiB
82de722+dirty 43.94 MiB 49.22 MiB 5.29 MiB

@github-actions
Copy link
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1210.55 ms 1209.43 ms -1.13 ms
Size 3.38 MiB 4.67 MiB 1.29 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
88812b1+dirty 1210.98 ms 1215.22 ms 4.24 ms
82de722+dirty 1210.87 ms 1217.00 ms 6.13 ms
b4df5a0+dirty 1217.06 ms 1221.61 ms 4.55 ms

App size

Revision Plain With Sentry Diff
88812b1+dirty 3.38 MiB 4.67 MiB 1.29 MiB
82de722+dirty 3.38 MiB 4.67 MiB 1.29 MiB
b4df5a0+dirty 3.38 MiB 4.67 MiB 1.29 MiB

@github-actions
Copy link
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1218.31 ms 1214.04 ms -4.27 ms
Size 3.38 MiB 4.67 MiB 1.29 MiB

Baseline results on branch: antonis/capture-app-start-errors-v8

Startup times

Revision Plain With Sentry Diff
88812b1+dirty 1216.63 ms 1215.55 ms -1.08 ms
82de722+dirty 1213.09 ms 1208.90 ms -4.19 ms
b4df5a0+dirty 1213.04 ms 1218.59 ms 5.55 ms

App size

Revision Plain With Sentry Diff
88812b1+dirty 3.38 MiB 4.67 MiB 1.29 MiB
82de722+dirty 3.38 MiB 4.67 MiB 1.29 MiB
b4df5a0+dirty 3.38 MiB 4.67 MiB 1.29 MiB

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

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants