-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
12.8.3 java.util.ConcurrentModificationException: null #3425
Comments
loadContext.getBatch() Should the copied List be returned?private LoadManyRequest(LoadManyBuffer loadContext, OrmQueryRequest<?> parentRequest, boolean lazy, boolean onlyIds, boolean loadCache) {
super(parentRequest, lazy);
this.loadContext = loadContext;
this.batch = loadContext.getBatch(); //Should the copied List be returned?
this.onlyIds = onlyIds;
this.loadCache = loadCache;
} |
Generally no. Each loadContext batch is expected to be built by a single thread (via a query that is executed by a single thread). So that means that the batch is not expected to be accessed by another thread during that time that it is being built/mutating. So I'm expecting something interesting to be going on here. Is there some application caching of entity beans going on? Is the query being used to populate an application cache (and this is done potentially via multiple concurrent threads?). |
An entity triggers lazy loading in two threads at the same time. Could this exception be caused? Is lazy loading thread-safe? |
Yes it is. There is a ReentrantLock that protects the batch lazy loading.
I don't think this is the case in that I think this case is more that there is 1 thread lazy loading and the other thread is still executing the query (still added to the batch load buffer). It could be something along the lines that there is a transaction spanning multiple queries, and that the entity beans are being put into an application cache such that they are accessible by another thread concurrently. Is there anything like that going on? I presume this is very hard to reproduce / create a failing test case. As a side point, are you locked into using Java 8? Have you considered getting to Java 11 and getting to the latest version of Ebean? |
It is difficult to upgrade the jdk version of the current system. Some of our systems have used the latest version of ebean and I feel that the overall system has improved greatly. I tried to reproduce the problem through test cases but failed. I later solved the problem through other methods, but this still is a dangerous question because it is too implicit |
So you don't see the exception anymore? What change did you make? |
Info: From several days, I've this issue. It was with the last Ebean version (and older). It was on Java 17 (and older) It was stress tests in order to reproduce the problem. It was exactly this task (#3425 (comment))
From this explanation
My solution: It is simple query, no update. So I abandon the parent object the moment I create a new thread, I only pass in the id. And with this identifier, I retrieve my child object, which then does not pose a lazy loading problem. |
I think we should close this ticket for now then. If we need further action we can reopen it etc. |
The text was updated successfully, but these errors were encountered: