Skip to content

[fix]: fix ConcurrentModificationException when completing invocations#362

Merged
zhongkechen merged 2 commits into
mainfrom
ConcurrentModificationException
Apr 30, 2026
Merged

[fix]: fix ConcurrentModificationException when completing invocations#362
zhongkechen merged 2 commits into
mainfrom
ConcurrentModificationException

Conversation

@zhongkechen

@zhongkechen zhongkechen commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Issue Link, if available

Fixes: #361

Description

  1. The test cases occasionally fail with ConcurrentModificationException, which is thrown when an invocation is completed and validating the operations.

SynchronizedMap was used to store the operations and the operations might be updated when validating them because operations running in the background (e.g. skipped map items) could be completed when validating.

Fix:

Replaced SynchronizedMap with ConcurrentHashMap that is safe to iterate when being updated

  1. Parallel branches that are added after the parallel result is checkpointed will not exist in the checkpointed result, leading to an OutOfBoundary exception during replay and occasional test case failures.

Fix:

Check the branch's existence in the checkpointed result when adding a new branch

Demo/Screenshots

Repeated the tests 40000+ times and the exception wasn't thrown

Checklist

  • I have filled out every section of the PR template
  • I have thoroughly tested this change

Testing

Unit Tests

Have unit tests been written for these changes? N/A

Integration Tests

Have integration tests been written for these changes? The two bugs were caught by existing tests

Examples

Has a new example been added for the change? (if applicable)

@zhongkechen zhongkechen self-assigned this Apr 30, 2026
@zhongkechen zhongkechen force-pushed the ConcurrentModificationException branch from 68f8a26 to 579fad8 Compare April 30, 2026 19:49
@zhongkechen zhongkechen marked this pull request as ready for review April 30, 2026 19:50
@zhongkechen zhongkechen requested a review from a team April 30, 2026 19:50
@zhongkechen zhongkechen force-pushed the ConcurrentModificationException branch from 579fad8 to d7536c7 Compare April 30, 2026 20:45
@zhongkechen zhongkechen merged commit 5fae79d into main Apr 30, 2026
11 checks passed
@zhongkechen zhongkechen deleted the ConcurrentModificationException branch April 30, 2026 22:32
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.

[Bug]: Tests fail occasionally with ConcurrentModificationException

2 participants