[jira] [Commented] (FELIX-4609) Possible ConcurrentModificationException in WatcherScanner

2014-09-09 Thread JIRA

[ 
https://issues.apache.org/jira/browse/FELIX-4609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14126926#comment-14126926
 ] 

Jean-Baptiste Onofré commented on FELIX-4609:
-

I submitted a patch in FELIX-4532 fixing the problem.

> 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.3.4#6332)


[jira] [Commented] (FELIX-4609) Possible ConcurrentModificationException in WatcherScanner

2014-09-02 Thread Andre Flakowski (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14118233#comment-14118233
 ] 

Andre Flakowski commented on FELIX-4609:


I reproduced the problem under Karaf 2.3.6 as well.
I traced it back to the same Issue: The problem is the removal of a config file 
in line 83 (changed.remove(file);) which causes the HashMap to throw the 
ConcurrentModificationException.

> 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.3.4#6332)


[jira] [Commented] (FELIX-4609) Possible ConcurrentModificationException in WatcherScanner

2014-08-20 Thread Daniel Kulp (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103883#comment-14103883
 ] 

Daniel Kulp commented on FELIX-4609:


It's partially duplicated by FELIX-4532, but I think the ScannerWatcher 
modifying the changed set is also a possible cause.

> 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.2#6252)


[jira] [Commented] (FELIX-4609) Possible ConcurrentModificationException in WatcherScanner

2014-08-20 Thread Daniel Kulp (JIRA)

[ 
https://issues.apache.org/jira/browse/FELIX-4609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103874#comment-14103874
 ] 

Daniel Kulp commented on FELIX-4609:


Actually, the ScannerWatcher could also be adding a file to the changed set 
during this iteration.   The nio based Watcher could be called at pretty much 
any time and then add the file to the changed set.   

In addition to the above, I'd recommend changing from a HashSet to a 
ConcurrentHashMap or CopyOnWriteArraySet or some other concurrent safe 
implementation.

> 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.2#6252)