You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2017/09/08 08:38:00 UTC
[jira] [Closed] (FELIX-4609) Possible
ConcurrentModificationException in WatcherScanner
[ https://issues.apache.org/jira/browse/FELIX-4609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet closed FELIX-4609.
----------------------------------
Resolution: Duplicate
> Possible ConcurrentModificationException in WatcherScanner
> ----------------------------------------------------------
>
> Key: FELIX-4609
> URL: https://issues.apache.org/jira/browse/FELIX-4609
> Project: Felix
> Issue Type: Bug
> Components: File Install
> Affects Versions: fileinstall-3.4.0
> Reporter: Daniel Kulp
>
> In some cases at startup, I'm getting:
> {code}
> 12:02:06,941 | ERROR | OT/container/etc | ? ? | 6 - org.apache.felix.fileinstall - 3.4.0 | In main loop, we have serious trouble
> java.util.ConcurrentModificationException
> at java.util.HashMap$HashIterator.nextEntry(HashMap.java:922)[:1.7.0_67]
> at java.util.HashMap$KeyIterator.next(HashMap.java:956)[:1.7.0_67]
> at org.apache.felix.fileinstall.internal.WatcherScanner.scan(WatcherScanner.java:70)[6:org.apache.felix.fileinstall:3.4.0]
> at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:305)[6:org.apache.felix.fileinstall:3.4.0]
> {code}
> The problem looks to stem from line 83 of WatcherScanner. The "changed" HashSet is being modified (remove call) within the for loop that is iterating over it.
> Most likely, a small change of:
> {code}
> Index: WatcherScanner.java
> ===================================================================
> --- WatcherScanner.java (revision 1619096)
> +++ WatcherScanner.java (working copy)
> @@ -78,10 +78,8 @@
> if ((newChecksum == lastChecksum || reportImmediately)) {
> if (newChecksum != storedChecksum) {
> storedChecksums.put(file, newChecksum);
> - files.add(file);
> - } else {
> - changed.remove(file);
> }
> + files.add(file);
> if (reportImmediately) {
> removed.remove(file);
> }
> {code}
> will fix it, but untested at this point.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)