Skip to content

Conversation

@eran-levy
Copy link

In some situations there are state elements in _derefCache HashSet causing ConcurrentModificationException because set has been modified during iteration.
Copy all elements into another set and calling the same deleteDeref(StateManagerImpl sm) function.

@eran-levy eran-levy changed the title fix ConcurrentModificationException during unrefed dependents cleanup OPENJPA-2725 - fix ConcurrentModificationException during unrefed dependents cleanup Jan 3, 2018
// mark for delete all elements in deref, otherwise in some situations it
// throws ConcurrentModificationException
statesMarkedForDelete.addAll(_derefCache);
if(statesMarkedForDelete.size()>0) {
Copy link
Member

Choose a reason for hiding this comment

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

This if can be safely removed: the subsequent foreach will skip in case of empty set

Copy link
Author

Choose a reason for hiding this comment

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

Correct, thanks. removed

@ilgrosso
Copy link
Member

ilgrosso commented Jan 3, 2018

Comment to link to OPENJPA-2725

@eran-levy
Copy link
Author

Fixed based on ilgrosso review

@asfgit asfgit closed this in 14d4b80 Jan 3, 2018
gmarseglia added a commit to gmarseglia/openjpa_isw2 that referenced this pull request Feb 5, 2025
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.

2 participants