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

ConcurrencyModificationException in DefaultEntityCallbacks [DATACMNS-1758] #2174

Closed
spring-projects-issues opened this issue Jun 29, 2020 · 1 comment
Assignees
Labels
in: mapping type: bug

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Jun 29, 2020

MyeongHyeonLee opened DATACMNS-1758 and commented

similar issue: https://jira.spring.io/browse/DATACMNS-1735

 

ConcurrentModificationException occurred.

 

 

Exception:java.util.ConcurrentModificationExceptionnull
  at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1042)
  at java.base/java.util.ArrayList$Itr.next(ArrayList.java:996)
  at org.springframework.data.mapping.callback.DefaultEntityCallbacks.callback(DefaultEntityCallbacks.java:83)
  at org.springframework.data.jdbc.core.JdbcAggregateTemplate.triggerBeforeSave(JdbcAggregateTemplate.java:414)
  at org.springframework.data.jdbc.core.JdbcAggregateTemplate.store(JdbcAggregateTemplate.java:335)
  at org.springframework.data.jdbc.core.JdbcAggregateTemplate.update(JdbcAggregateTemplate.java:183)

 

  • callbackDiscoverer.getEntityCallbacks result is cached. but, this List<EntityCallback<T>> can be updated.

 

 

for (EntityCallback<T> callback : callbackDiscoverer.getEntityCallbacks(entityType,
      ResolvableType.forClass(callbackType))) {
}

 

I think it is safe to cache the List locally before executing the loop.

 

 


Affects: 2.3.1 (Neumann SR1)

Issue Links:

Referenced from: pull request #453

Backported to: 2.3.2 (Neumann SR2)

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Jul 9, 2020

Mark Paluch commented

We decided to revert the optimization introduced with DATACMNS-1698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping type: bug
Projects
None yet
Development

No branches or pull requests

2 participants