classgraph: ConcurrentModificationException while getting ScanResult output
Sometimes this happens:
java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:937)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:891)
at io.github.classgraph.ScanResult.getResourcesMatchingPattern(ScanResult.java:383)
My call looks innocent enough:
val configUrls = new ClassGraph().scan()
.getResourcesMatchingPattern(configRegex.r.pattern)
.asScala
.map(_.getURL)
Is it possible to fix it?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 45 (27 by maintainers)
Commits related to this issue
- some changes on classgraph usage, may fix https://github.com/classgraph/classgraph/issues/257 — committed to 7mind/izumi by pshirshov 6 years ago
- Don't clear collections in `close()` (#257); make isClosed atomic — committed to classgraph/classgraph by lukehutch 6 years ago
- Remove finalize() (#257) — committed to classgraph/classgraph by lukehutch 6 years ago
Eh, I’ve uncovered a pandora’s box. My world will never be the same.
Though the conclusion is simple: we must never use finalizers except of situations when our app is completely independent of when they may be executed and if they may be executed. Crap-crap-crap.