public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/27028]  New: Eclipse Update Manager throws ConcurrentModificationExceptions
@ 2006-04-04 16:15 overholt at redhat dot com
  2006-04-04 19:52 ` [Bug libgcj/27028] " mckinlay at redhat dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: overholt at redhat dot com @ 2006-04-04 16:15 UTC (permalink / raw)
  To: java-prs

While using the Eclipse update manager to install software, it sometimes fails
with a ConcurrentModificationException.  This seems to only happen some of the
time but most often on the first attempt at installing Subclipse (ie. when it
does the entire download, verification, etc.).  Here's how to install
Subclipse:

http://subclipse.tigris.org/install.html


-- 
           Summary: Eclipse Update Manager throws
                    ConcurrentModificationExceptions
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: overholt at redhat dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libgcj/27028] Eclipse Update Manager throws ConcurrentModificationExceptions
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
@ 2006-04-04 19:52 ` mckinlay at redhat dot com
  2006-04-04 20:34 ` [Bug classpath/27028] " mckinlay at redhat dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2006-04-04 19:52 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from mckinlay at redhat dot com  2006-04-04 19:52 -------
I couldn't reproduce this when installing Subclipse, but after installing it
and subsequently trying to disable it, I reproducably get the following crash:

java.util.ConcurrentModificationException.ConcurrentModificationException()
(this=@87474b0)
    at
../../../libjava/classpath/java/util/ConcurrentModificationException.java:80
80        {
(gdb) bt
#0  java.util.ConcurrentModificationException.ConcurrentModificationException()
    (this=@87474b0)
    at
../../../libjava/classpath/java/util/ConcurrentModificationException.java:80
#1  0x0349ded2 in java.util.HashMap$HashIterator.hasNext() (this=@5f3f000)
    at ../../../libjava/classpath/java/util/HashMap.java:856
#2  0x01efadb8 in
org::eclipse::update::internal::model::ConfigurationPolicyModel::remove () from
/usr/lib/gcj/eclipse/org.eclipse.update.core_3.1.2.jar.so
#3  0x01efb2df in
org::eclipse::update::internal::model::ConfigurationPolicyModel::addUnconfiguredFeatureReference
()
   from /usr/lib/gcj/eclipse/org.eclipse.update.core_3.1.2.jar.so
#4  0x01ec56bb in
org::eclipse::update::internal::core::ConfigurationPolicy::unconfigure () from
/usr/lib/gcj/eclipse/org.eclipse.update.core_3.1.2.jar.so


The relevent Eclipse code is: 
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.update.core/src/org/eclipse/update/internal/model/ConfigurationPolicyModel.java?rev=1.25&content-type=text/vnd.viewcvs-markup

        /**
         * 
         */
        private boolean remove(FeatureReferenceModel feature, Map list) {
                URL featureURL = feature.getURL();
                boolean found = false;
                Iterator iter = list.keySet().iterator();
                while (iter.hasNext() && !found) {
                        FeatureReferenceModel element = (FeatureReferenceModel)
iter.next();
                        if
(UpdateManagerUtils.sameURL(element.getURL(),featureURL)) {
                                list.remove(element);
                                found = true;
                        }
                }
                return found;
        }

This code is buggy: it is directly modifying an underlying collection (list)
while an iterator on that collection (iter) is active. This is not allowed
according to the J2SE documentation: 

"The iterators returned by all of this class's "collection view methods" are
fail-fast: if the map is structurally modified at any time after the iterator
is created, in any way except through the iterator's own remove or add methods,
the iterator will throw a ConcurrentModificationException. "

If this code works on Sun's implementation, then it would appear that Sun's
implementation does not conform with their own spec.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Eclipse Update Manager throws ConcurrentModificationExceptions
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
  2006-04-04 19:52 ` [Bug libgcj/27028] " mckinlay at redhat dot com
@ 2006-04-04 20:34 ` mckinlay at redhat dot com
  2006-04-05  6:38 ` [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException mark at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2006-04-04 20:34 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from mckinlay at redhat dot com  2006-04-04 20:34 -------
The difference between Sun's and Classpath's implementation appears to be that
Classpath will check for Concurrent Modification on both hasNext() and next()
calls, while Sun's implementation only checks next() calls.


-- 

mckinlay at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mckinlay at redhat dot com
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
          Component|libgcj                      |classpath
     Ever Confirmed|0                           |1
            Product|gcc                         |classpath
   Last reconfirmed|0000-00-00 00:00:00         |2006-04-04 20:34:07
               date|                            |
   Target Milestone|---                         |0.91
            Version|4.1.0                       |0.90


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
  2006-04-04 19:52 ` [Bug libgcj/27028] " mckinlay at redhat dot com
  2006-04-04 20:34 ` [Bug classpath/27028] " mckinlay at redhat dot com
@ 2006-04-05  6:38 ` mark at gcc dot gnu dot org
  2006-04-05  7:05 ` rmathew at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mark at gcc dot gnu dot org @ 2006-04-05  6:38 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from mark at gcc dot gnu dot org  2006-04-05 06:38 -------
This might (or might not) be related to bug #24752 although also in that case
it could be argued that the user code is just buggy and should be fixed. See
also bug #24632 which is also similar, but in that case the Axis developers
just fixed their code.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
                   ` (2 preceding siblings ...)
  2006-04-05  6:38 ` [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException mark at gcc dot gnu dot org
@ 2006-04-05  7:05 ` rmathew at gcc dot gnu dot org
  2006-04-05 15:19 ` mckinlay at redhat dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rmathew at gcc dot gnu dot org @ 2006-04-05  7:05 UTC (permalink / raw)
  To: java-prs



------- Comment #4 from rmathew at gcc dot gnu dot org  2006-04-05 07:05 -------
(In reply to comment #2)
> The difference between Sun's and Classpath's implementation appears to be that
> Classpath will check for Concurrent Modification on both hasNext() and next()
> calls, while Sun's implementation only checks next() calls.

I would argue that Sun's implementation is correct in this case in the
sense that hasNext() doesn't actually modify anything, only next() does.
I agree that the user code is buggy, gets a potentially bogus answer with
hasNext() and is simply asking for trouble, but the said trouble doesn't
happen unless it actually calls next(). You cannot throw an exception on
me if I merely intend to screw up - do that only if I actually screw up.

My 2p.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
                   ` (3 preceding siblings ...)
  2006-04-05  7:05 ` rmathew at gcc dot gnu dot org
@ 2006-04-05 15:19 ` mckinlay at redhat dot com
  2006-04-05 15:20 ` mckinlay at redhat dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2006-04-05 15:19 UTC (permalink / raw)
  To: java-prs



------- Comment #5 from mckinlay at redhat dot com  2006-04-05 15:19 -------
(In reply to comment #4)
> I would argue that Sun's implementation is correct in this case in the
> sense that hasNext() doesn't actually modify anything, only next() does.

Yeah, I agree - although you might get a bogus answer for hasNext(), 99% of the
time, the application is about to call next(), so they'll get the exception
there anyway. Changing this also gives a slight performance improvement for
iterators.

This bug seems to be coming up pretty regularly. I'm working on a patch and
test case for it.


-- 

mckinlay at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|mckinlay at redhat dot com  |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
                   ` (4 preceding siblings ...)
  2006-04-05 15:19 ` mckinlay at redhat dot com
@ 2006-04-05 15:20 ` mckinlay at redhat dot com
  2006-04-05 15:22 ` mckinlay at redhat dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2006-04-05 15:20 UTC (permalink / raw)
  To: java-prs



-- 

mckinlay at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mckinlay at redhat dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-04-04 20:34:07         |2006-04-05 15:20:02
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
                   ` (5 preceding siblings ...)
  2006-04-05 15:20 ` mckinlay at redhat dot com
@ 2006-04-05 15:22 ` mckinlay at redhat dot com
  2006-04-05 18:41 ` bryce at gcc dot gnu dot org
  2006-04-05 18:43 ` mckinlay at redhat dot com
  8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2006-04-05 15:22 UTC (permalink / raw)
  To: java-prs



------- Comment #6 from mckinlay at redhat dot com  2006-04-05 15:22 -------
*** Bug 24632 has been marked as a duplicate of this bug. ***


-- 

mckinlay at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gnuclasspath dot 10 dot
                   |                            |bertnase at spamgourmet dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
                   ` (6 preceding siblings ...)
  2006-04-05 15:22 ` mckinlay at redhat dot com
@ 2006-04-05 18:41 ` bryce at gcc dot gnu dot org
  2006-04-05 18:43 ` mckinlay at redhat dot com
  8 siblings, 0 replies; 10+ messages in thread
From: bryce at gcc dot gnu dot org @ 2006-04-05 18:41 UTC (permalink / raw)
  To: java-prs



------- Comment #7 from bryce at gcc dot gnu dot org  2006-04-05 18:41 -------
Subject: Bug 27028

Author: bryce
Date: Wed Apr  5 18:41:17 2006
New Revision: 112714

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=112714
Log:
2006-04-05  Bryce McKinlay  <mckinlay@redhat.com>

        PR classpath/27028
        PR classpath/24752
        * java/util/AbstractList.java (hasNext): Don't throw
        ConcurrentModificationException. Update Javadoc.
        (hasPrevious): Likewise.
        (nextIndex): Likewise.
        (previousIndex): Likewise.
        * java/util/HashMap.java (hasNext): Likewise.
        * java/util/Hashtable.java (hasNext): Likewise.
        * java/util/IdentityHashMap.java (hasNext): Likewise.
        * java/util/LinkedHashMap.java (hasNext): Likewise.
        * java/util/LinkedList.java (nextIndex): Likewise.
        (previousIndex): Likewise.
        (hasNext): Likewise.
        (hasPrevious): Likewise.
        * java/util/TreeMap.java (hasNext): Likewise.
        * java/util/WeakHashMap.java (hasNext): Likewise.

Modified:
    branches/gcc-4_1-branch/libjava/classpath/ChangeLog.gcj
    branches/gcc-4_1-branch/libjava/classpath/java/util/AbstractList.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/HashMap.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/Hashtable.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/IdentityHashMap.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/LinkedHashMap.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/LinkedList.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/TreeMap.java
    branches/gcc-4_1-branch/libjava/classpath/java/util/WeakHashMap.java


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException
  2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
                   ` (7 preceding siblings ...)
  2006-04-05 18:41 ` bryce at gcc dot gnu dot org
@ 2006-04-05 18:43 ` mckinlay at redhat dot com
  8 siblings, 0 replies; 10+ messages in thread
From: mckinlay at redhat dot com @ 2006-04-05 18:43 UTC (permalink / raw)
  To: java-prs



------- Comment #8 from mckinlay at redhat dot com  2006-04-05 18:43 -------
Fix checked in to Classpath HEAD and gcc-4_1_branch


-- 

mckinlay at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27028


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-04-05 18:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-04 16:15 [Bug java/27028] New: Eclipse Update Manager throws ConcurrentModificationExceptions overholt at redhat dot com
2006-04-04 19:52 ` [Bug libgcj/27028] " mckinlay at redhat dot com
2006-04-04 20:34 ` [Bug classpath/27028] " mckinlay at redhat dot com
2006-04-05  6:38 ` [Bug classpath/27028] Iterator.hasNext() throws ConcurrentModificationException mark at gcc dot gnu dot org
2006-04-05  7:05 ` rmathew at gcc dot gnu dot org
2006-04-05 15:19 ` mckinlay at redhat dot com
2006-04-05 15:20 ` mckinlay at redhat dot com
2006-04-05 15:22 ` mckinlay at redhat dot com
2006-04-05 18:41 ` bryce at gcc dot gnu dot org
2006-04-05 18:43 ` mckinlay at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).