You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "nicolas de loof (JIRA)" <ji...@codehaus.org> on 2007/04/03 09:00:07 UTC
[jira] Created: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
ConcurrentModificationException : TransferEventSupport needs synchronization
----------------------------------------------------------------------------
Key: WAGON-79
URL: http://jira.codehaus.org/browse/WAGON-79
Project: wagon
Issue Type: Bug
Components: wagon-provider-api
Affects Versions: 1.0
Environment: archiva Snapshot
Reporter: nicolas de loof
I get some thraead-safety issues with maven archiva :
2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
There is a thread-safety issue in Wagon TransferEventSupport
The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/WAGON-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_91903 ]
Carlos Sanchez commented on WAGON-79:
-------------------------------------
only the methods that modify the array should be inside a synchronized(this), no?
> ConcurrentModificationException : TransferEventSupport needs synchronization
> ----------------------------------------------------------------------------
>
> Key: WAGON-79
> URL: http://jira.codehaus.org/browse/WAGON-79
> Project: wagon
> Issue Type: Bug
> Components: wagon-provider-api
> Affects Versions: 1.0
> Environment: archiva Snapshot
> Reporter: nicolas de loof
> Attachments: WAGON-79.patch
>
>
> I get some thraead-safety issues with maven archiva :
> 2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
> at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
> There is a thread-safety issue in Wagon TransferEventSupport
> The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
> This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
Posted by "nicolas de loof (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/WAGON-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
nicolas de loof updated WAGON-79:
---------------------------------
Attachment: WAGON-79.patch
synchronized acces to listeners ArrayList
> ConcurrentModificationException : TransferEventSupport needs synchronization
> ----------------------------------------------------------------------------
>
> Key: WAGON-79
> URL: http://jira.codehaus.org/browse/WAGON-79
> Project: wagon
> Issue Type: Bug
> Components: wagon-provider-api
> Affects Versions: 1.0
> Environment: archiva Snapshot
> Reporter: nicolas de loof
> Attachments: WAGON-79.patch
>
>
> I get some thraead-safety issues with maven archiva :
> 2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
> at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
> There is a thread-safety issue in Wagon TransferEventSupport
> The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
> This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
Posted by "nicolas de loof (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/WAGON-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
nicolas de loof updated WAGON-79:
---------------------------------
Attachment: WAGON-79-testcase.patch
This new patch includes a test-case that demonstrates the issue.
This may not be fully reproductible as unit-testing thread safety is not easy.
The idea of the test is :
create a listener (mock1) that takes 500ms to handle the event.
the listener is registered 2 times.
a new thread is started, with a Runnable that will fire an event.
The main test Thread waits this new thread to be started and fire secondevent. The wait-timing is expected to have :
- Testcase thread running
- Event fired from second thread, first listener notified (500ms wait)
mock1 is registered as a 3d listener. The listener list is updated
when the second thread iterates the list for next listener, the list has been updated and a ConcurrentModificationException is thrown.
I don't know any thread-safety unit tool that may make such testcase esaier / cleaner.
> ConcurrentModificationException : TransferEventSupport needs synchronization
> ----------------------------------------------------------------------------
>
> Key: WAGON-79
> URL: http://jira.codehaus.org/browse/WAGON-79
> Project: wagon
> Issue Type: Bug
> Components: wagon-provider-api
> Affects Versions: 1.0
> Environment: archiva Snapshot
> Reporter: nicolas de loof
> Attachments: WAGON-79-testcase.patch, WAGON-79.patch
>
>
> I get some thraead-safety issues with maven archiva :
> 2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
> at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
> There is a thread-safety issue in Wagon TransferEventSupport
> The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
> This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
Posted by "nicolas de loof (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/WAGON-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_91905 ]
nicolas de loof commented on WAGON-79:
--------------------------------------
The methods that iterates on the List will throw a ConcurrentModificationException if the list is modified during iteration. Synchronizing only the add/remove will not avoid another thread to fire an event and acces the list for iteration.
An alternative to synchronized methods is to use a CopyOnWriteArrayList. For java 1.4 compatibilty this requires to add backport-util-concurrent as a dependency.
> ConcurrentModificationException : TransferEventSupport needs synchronization
> ----------------------------------------------------------------------------
>
> Key: WAGON-79
> URL: http://jira.codehaus.org/browse/WAGON-79
> Project: wagon
> Issue Type: Bug
> Components: wagon-provider-api
> Affects Versions: 1.0
> Environment: archiva Snapshot
> Reporter: nicolas de loof
> Attachments: WAGON-79.patch
>
>
> I get some thraead-safety issues with maven archiva :
> 2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
> at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
> There is a thread-safety issue in Wagon TransferEventSupport
> The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
> This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/WAGON-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Porter updated WAGON-79:
------------------------------
Fix Version/s: 1.0-beta-3
> ConcurrentModificationException : TransferEventSupport needs synchronization
> ----------------------------------------------------------------------------
>
> Key: WAGON-79
> URL: http://jira.codehaus.org/browse/WAGON-79
> Project: Maven Wagon
> Issue Type: Bug
> Components: wagon-provider-api
> Affects Versions: 1.0-beta-3
> Environment: archiva Snapshot
> Reporter: nicolas de loof
> Fix For: 1.0-beta-3
>
> Attachments: WAGON-79-testcase.patch, WAGON-79.patch
>
>
> I get some thraead-safety issues with maven archiva :
> 2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
> at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
> There is a thread-safety issue in Wagon TransferEventSupport
> The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
> This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (WAGON-79) ConcurrentModificationException :
TransferEventSupport needs synchronization
Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/WAGON-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Porter closed WAGON-79.
-----------------------------
Assignee: Brett Porter
Resolution: Fixed
applied the main patch - I think the thread safety test is problematic due to timing and threading, so we can just retain the primitives.
I used the method level syncs from the patch since it would be equivalent to blocks that sync on listeners
> ConcurrentModificationException : TransferEventSupport needs synchronization
> ----------------------------------------------------------------------------
>
> Key: WAGON-79
> URL: http://jira.codehaus.org/browse/WAGON-79
> Project: Maven Wagon
> Issue Type: Bug
> Components: wagon-provider-api
> Affects Versions: 1.0-beta-3
> Environment: archiva Snapshot
> Reporter: nicolas de loof
> Assignee: Brett Porter
> Fix For: 1.0-beta-3
>
> Attachments: WAGON-79-testcase.patch, WAGON-79.patch
>
>
> I get some thraead-safety issues with maven archiva :
> 2007-04-02 10:11:25,392 [http-8888-1] ERROR [RepositoryServlet] - "Servlet.service()" pour la servlet RepositoryServlet a généré une exception
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress (TransferEventSupport.java:117)
> at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:350)
> There is a thread-safety issue in Wagon TransferEventSupport
> The listeners list is an ArrayList and add/remove/fireEvent methods are not synchronized.
> This requires either synchronization or use of a CopyOnWriteArrayList (java5 or backport).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira