JDK-6890389 : Race condition in parallel downloading of jars for applets and web-start
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 6u18
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2009-10-11
  • Updated: 2010-04-04
  • Resolved: 2009-10-16
Related Reports
Duplicate :  
Description
It looks like there is a race condition in recently implemented parallel 
downloading of jars for applets and web-start (see 6689313). 
Starting from 6u18b03 javaws and plugins fails pretty regularly with 

java.io.IOException: Cannot find cached resource for URL: file:<path to application jar>
 at com.sun.deploy.net.DownloadEngine.getCacheResourceFilePath(Unknown Source)                                          
 at com.sun.javaws.LaunchDownload.getSignedJNLPFile(Unknown Source)                                                     
 at com.sun.javaws.LaunchDownload.checkSignedLaunchDescHelper(Unknown Source)                                           
 at com.sun.javaws.LaunchDownload.checkSignedLaunchDesc(Unknown Source)                                                 
 at com.sun.javaws.Launcher.prepareResources(Unknown Source)                                                            
 at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)                                                         
 at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)                                                             
 at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)                                                             
 at com.sun.javaws.Launcher.launch(Unknown Source)                                                                      
 at com.sun.javaws.Main.launchApp(Unknown Source)                                                                       
 at com.sun.javaws.Main.continueInSecureThread(Unknown Source)                                                          
 at com.sun.javaws.Main$1.run(Unknown Source)                                                                           
 at java.lang.Thread.run(Unknown Source)
One concurrent exception on the download thread that can potentially prevent downloading of jars.

I found this exception from my own tests. This exception is not showing in Katya's test trace though.

java.util.ConcurrentModificationException
	at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
	at java.util.AbstractList$Itr.next(AbstractList.java:343)
	at com.sun.javaws.LaunchDownload$DownloadCallbackHelper.getProgressRecord(LaunchDownload.java:479)
	at com.sun.javaws.LaunchDownload$DownloadCallbackHelper.downloading(LaunchDownload.java:432)
	at com.sun.deploy.net.DownloadEngine$4.downloadProgress(DownloadEngine.java:1348)
	at com.sun.deploy.net.HttpDownloadHelper.decompressWrite(HttpDownloadHelper.java:261)
	at com.sun.deploy.net.HttpDownloadHelper.download(HttpDownloadHelper.java:134)
	at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Cache.java:526)
	at com.sun.deploy.cache.Cache.downloadResourceToCache(Cache.java:487)
	at com.sun.deploy.net.DownloadEngine.actionDownload(DownloadEngine.java:1359)
	at com.sun.deploy.net.DownloadEngine.getCacheEntry(DownloadEngine.java:1524)
	at com.sun.deploy.net.DownloadEngine.getCacheEntry(DownloadEngine.java:1502)
	at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(DownloadEngine.java:1605)
	at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(DownloadEngine.java:1533)
	at com.sun.deploy.net.DownloadEngine.getResource(DownloadEngine.java:217)
	at com.sun.javaws.LaunchDownload$DownloadTask.call(LaunchDownload.java:1643)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

Comments
EVALUATION This CR is fixed under CR 6863499.
16-10-2009

EVALUATION It looks that the major reason of download failure is caused by exceptions thrown from progress bar helper class. After make most methods of that class synchronized, I can run about 100 iterations without a failure. Because of a awt deadlock bug on X11 (CR 6811219), the test can not run for every long time. 100 iterations seem to be enough to prove the root cause. With 6u18 b03, I usually get the failure within 20 iterations.
15-10-2009