United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4918294 : Occasional ConcurrentModificationException during applet download

Details
Type:
Bug
Submit Date:
2003-09-05
Status:
Resolved
Updated Date:
2004-10-13
Project Name:
JDK
Resolved Date:
2003-09-30
Component:
deploy
OS:
windows_nt,windows_xp
Sub-Component:
plugin
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.2,1.4.2_04
Fixed Versions:
1.4.2_07 (b01)

Related Reports
Backport:

Sub Tasks

Description
Name: gm110360			Date: 09/05/2003


FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Microsoft Internet Explorer 6.0 SP1 [Version 6.0.2800.1106]
IBM HTTP Server 2.0.42

Plug-in JRE configured as "JRE 1.4.2 in C:\Program Files\Java\j2re1.4.2"


A DESCRIPTION OF THE PROBLEM :
When downloading a web based application containing java applets the java plugin occasionally throws a ConcurrentModificationException when the applet jar file has been updated at the web server. Application startup fails when the exception is thrown.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempts to produce a pared-down version of the web application suitable for inclusion here have failed to reproduce the problem. Even our web application does not cause the problem to occur in a repeatable manner, although the problem does occur daily.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A ConcurrentModificationException should not be thrown.
ACTUAL -
See stack trace for details.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.util.ConcurrentModificationException	at java.util.AbstractList$Itr.checkForComodification(Unknown Source)	at java.util.AbstractList$Itr.remove(Unknown Source)	at sun.plugin.cache.JarCache.match(Unknown Source)	at sun.plugin.cache.JarCache.getMatchingFile(Unknown Source)	at sun.plugin.cache.CachedJarLoader$4.run(Unknown Source)	at java.security.AccessController.doPrivileged(Native Method)	at sun.plugin.cache.CachedJarLoader.getCacheFile(Unknown Source)	at sun.plugin.cache.CachedJarLoader.<init>(Unknown Source)	at sun.plugin.cache.JarCache.get(Unknown Source)	at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)	at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)	at sun.misc.URLClassPath$JarLoader.getJarFile(Unknown Source)	at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)	at sun.misc.URLClassPath$3.run(Unknown Source)	at java.security.AccessController.doPrivileged(Native Method)	at sun.misc.URLClassPath.getLoader(Unknown Source)	at sun.misc.URLClassPath.getLoader(Unknown Source)	at sun.misc.URLClassPath.getResource(Unknown Source)	at java.net.URLClassLoader$1.run(Unknown Source)	at java.security.AccessController.doPrivileged(Native Method)	at java.net.URLClassLoader.findClass(Unknown Source)	at sun.applet.AppletClassLoader.findClass(Unknown Source)	at java.lang.ClassLoader.loadClass(Unknown Source)	at sun.applet.AppletClassLoader.loadClass(Unknown Source)	at java.lang.ClassLoader.loadClass(Unknown Source)	at sun.applet.AppletClassLoader.loadCode(Unknown Source)	at sun.applet.AppletPanel.createApplet(Unknown Source)	at sun.plugin.AppletViewer.createApplet(Unknown Source)	at sun.applet.AppletPanel.runLoader(Unknown Source)	at sun.applet.AppletPanel.run(Unknown Source)	at java.lang.Thread.run(Unknown Source)

REPRODUCIBILITY :
This bug can be reproduced occasionally.

---------- BEGIN SOURCE ----------
The main focus of the web based application, from a java perspective, is that two applets are being accessed from a single JAR file. See the two <object> tags in the following launch page content for details:

<?xml version="1.0" ?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Web Based Application</title>

  <!-- Launch page include Files (JScript) -->

  <link rel="stylesheet" href="css/Styles.css" type="text/css" />
</head>

<body class="index" onload="windowOnload();" onunload="windowOnUnload();">

  <script src="menu/menuLoad.js" type="text/javascript"></script>

  <object id="FirstComponent"
          classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
          align="top"
          width="0"
          height="0">
    <param name="code" value="uk.co.xxx.yyy.zzz.applet.AppletOne.class" />
    <param name="codebase" value="." />
    <param name="archive" value="AppletsArchive.jar,axis.jar,commons-discovery.jar,commons-logging.jar,jaxrpc.jar,log4j-1.2.8.jar,saaj.jar,wsdl4j.jar,xerces.jar,xalan.jar,commons-logging-api.jar,j2ee.jar" />
    <param name="type" value="application/x-java-applet;version=1.3" />
    <param name="scriptable" value="true" />
  </object>
  <object id="SecondComponent"
          classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
          align="top"
          width="0"
          height="0">
    <param name="code" value="uk.co.xxx.yyy.zzz.applet.AppletTwo.class" />
    <param name="codebase" value="." />
    <param name="archive" value="AppletsArchive.jar,commons-logging.jar,log4j-1.2.8.jar,xerces.jar,xalan.jar,commons-logging-api.jar" />
    <param name="type" value="application/x-java-applet;version=1.3" />
    <param name="scriptable" value="true" />
  </object>

  <!-- Rest of launch page content -->

</body>
</html>
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
The current workaround involves clearing the plugin cache every time before starting the web application.
(Incident Review ID: 198644) 
======================================================================

                                    

Comments
EVALUATION

Several methods in JarCache.java, FileCache.java, and Cache.java
need to be synchronized to avoid concurrent access and dirty read.

###@###.### 2003-09-19
                                     
2003-09-19
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_07
tiger

FIXED IN:
1.4.2_07
tiger

INTEGRATED IN:
1.4.2_07
tiger
tiger-b22


                                     
2004-09-17



Hardware and Software, Engineered to Work Together