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

1.7.0: concurrent modification exception #1405

Closed
JohannesBeranek opened this issue Apr 20, 2022 · 8 comments
Closed

1.7.0: concurrent modification exception #1405

JohannesBeranek opened this issue Apr 20, 2022 · 8 comments
Labels
Milestone

Comments

@JohannesBeranek
Copy link

JohannesBeranek commented Apr 20, 2022

Play version 1.7.0, DEV mode

Looks to me like the amount of concurrentModificationException encountered in DEV mode suddenly skyrocketed. We only had those very very sparsely before, but with play version 1.7.0 they happen about every 10th request.

Always in ApplicationClasses.getApplicationClass. Maybe classes Map should be replaced with a ConcurrentHashMap / add synchronization ?

@aleksandy
Copy link
Contributor

Could you provide stacktrace of the exception?

I assume the cause of ConcurrentModificationException is computeIfAbsent() that has added in 8fad39b. But in my opinion there is no reasons to change map type to concurrent version because in production you use precompiled classes (don't you?) and hashmap will be filled by the all classes before the first concurent request.

Also thread-unsafe map is good choice for readonly work in multithread env because it has more performance because it doesn't care about sync.

@asolntsev
Copy link
Contributor

@aleksandy Yes, we experienced ConcurrentModificationException in DEV mode, but it was also a problem: the application suddenly restarted, sometimes even multiple times.

@aleksandy
Copy link
Contributor

@asolntsev, looks like we don't have a choice. The map should be changed to ConcurrentHashMap. I've send PR.

@JohannesBeranek
Copy link
Author

We haven't tried this version in production, as there are a few show stoppers for us to upgrade (this one and the issue with LoggerInit::access()). Still, it's an issue with dev workflow, as this basically makes live-reload unusable in DEV mode.

Of course, you could also just synchronize on write access instead and use a regular HashMap, but for us this isn't really a performance critical part of the application (what are we talking, a few ns maybe?).

xael-fry added a commit that referenced this issue Jun 3, 2022
#1405: replace HashMap be ConcurrentHashMap
@aleksandy
Copy link
Contributor

@JohannesBeranek, could you check if the merged fix solve your issue. And close the issue if so.

@xael-fry xael-fry added the defect label Jun 6, 2022
@xael-fry xael-fry added this to the 1.7.1 milestone Jun 6, 2022
@xael-fry
Copy link
Member

xael-fry commented Jun 6, 2022

merges #1408

@xael-fry xael-fry closed this as completed Jun 6, 2022
@xael-fry
Copy link
Member

xael-fry commented Jun 6, 2022

@JohannesBeranek what is the issue about LoggerInit::acces, did you create an issue for it, I didn't find it

Thanks

@JohannesBeranek
Copy link
Author

@xael-fry I'll gladly try the changes once I get around to, but that might not be for some time.
As for the issue about LoggerInit::access see issue #1404

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

No branches or pull requests

4 participants