VFS scan is not thread-safe
GoogleCodeExporter opened this issue · comments
Google Code Exporter commented
What steps will reproduce the problem?
1. Run multiple threads with VFS scan
What is the expected output? What do you see instead?
Caused by: java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java:343)
at org.reflections.vfs.Vfs.fromURL(Vfs.java:96)
at org.reflections.vfs.Vfs.fromURL(Vfs.java:91)
at org.reflections.Reflections.scan(Reflections.java:231)
at org.reflections.Reflections.scan(Reflections.java:204)
at org.reflections.Reflections.<init>(Reflections.java:129)
What version of the product are you using? On what operating system?
0.9.8 / 0.9.9-RC1
Original issue reported on code.google.com by david.ca...@gmail.com
on 7 Jan 2014 at 9:29
Google Code Exporter commented
The code :
Vfs.addDefaultURLTypes(new VfsUrlType());
final Reflections reflections = new Reflections(
new ConfigurationBuilder()
.filterInputsBy(
new FilterBuilder().include(FilterBuilder
.prefix(packageName)))
.setUrls(ClasspathHelper.forPackage(packageName))
.setScanners(new SubTypesScanner(false),
new TypeAnnotationsScanner(),
new ResourcesScanner()));
return reflections;
Original comment by david.ca...@gmail.com
on 7 Jan 2014 at 9:31
Google Code Exporter commented
This is not clear.
Are you calling Vfs.addDefaultURLTypes from multiple threads in the same VM,
while scan is ongoing?
Are you trying to do a single parallel scan?
org.reflections.vfs.Vfs#defaultUrlTypes should not be changing when scan is
happening.
Original comment by ronm...@gmail.com
on 7 Jan 2014 at 10:22
Google Code Exporter commented
There is 2 parrallels EJB calls, calling the code a million times each, working
in the same VM (JBoss AS 7.2).
Original comment by david.ca...@gmail.com
on 7 Jan 2014 at 2:10
Google Code Exporter commented
there you go. scan once, query anywhere.
Original comment by ronm...@gmail.com
on 7 Jan 2014 at 2:16
- Changed state: Invalid
Google Code Exporter commented
I cannot scan once beacause "packageName" is a variable.
Original comment by david.ca...@gmail.com
on 7 Jan 2014 at 5:24