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

ConcurrentModificationException will be reported when concurrent #23

Open
Jude95 opened this issue Jul 7, 2022 · 9 comments · Fixed by #27
Open

ConcurrentModificationException will be reported when concurrent #23

Jude95 opened this issue Jul 7, 2022 · 9 comments · Fixed by #27

Comments

@Jude95
Copy link

Jude95 commented Jul 7, 2022

java.util.ConcurrentModificationException
        java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:756)
        java.base/java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:778)
        io.github.reactivecircus.cache4k.RealCache.expireEntries(RealCache.kt:174)
        io.github.reactivecircus.cache4k.RealCache.put(RealCache.kt:120)
@Shabinder
Copy link

+1:

java.util.ConcurrentModificationException at 
java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:760) at
java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:782) at
kotlin.collections.CollectionsKt___CollectionsKt.firstOrNull(_Collections.kt:272) at
io.github.reactivecircus.cache4k.RealCache.evictEntries(RealCache.kt:206) at
io.github.reactivecircus.cache4k.RealCache.put(RealCache.kt:140)

@ychescale9
Copy link
Member

I think we need to revert back to using stately which is thread-safe on JVM.

@Shabinder
Copy link

@ychescale9 will you be making a release anytime soon ?

@ychescale9
Copy link
Member

I'll try to find some time in the coming weeks.

@luca992
Copy link
Contributor

luca992 commented Feb 23, 2024

So I'm having issues with cache4k and ConcurrentModificationExceptions caused by stately on jvm.

Ktor's io.ktor.util.collections.ConcurrentMap seems to be stable, maybe their implementation could be used instead?

@ychescale9
Copy link
Member

Thanks, will look into it.

@hoc081098
Copy link

+1 for Ktor Utils Collections 😊

@ychescale9
Copy link
Member

looks like ktor's ConcurrentMap just delegates to ConcurrentHashMap on JVM which I've done in #39, though there are still some linearizability issues surfaced by Lincheck. Maybe we can land that change now and deal with the remaining issues later as they are not regressions.

@ychescale9 ychescale9 reopened this Feb 23, 2024
@ychescale9
Copy link
Member

Just released 0.13.0 with ConcurrentHashMap on JVM. Please let me know if this fixes the issue.

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 a pull request may close this issue.

5 participants