United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6929021 Performance problem with DeployCacheHandler
JDK-6929021 : Performance problem with DeployCacheHandler

Details
Type:
Bug
Submit Date:
2010-02-23
Status:
Resolved
Updated Date:
2010-09-16
Project Name:
JDK
Resolved Date:
2010-03-09
Component:
deploy
OS:
windows_xp
Sub-Component:
deployment_toolkit
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u17
Fixed Versions:
6u21 (b01)

Related Reports
Backport:

Sub Tasks

Description
Find a ugly performance problem with DeployCacheHandler in an applet 
and might in web start. The problem is that the DeployCacheHandler create a socket
and read the HTTP headers in a synchronized. This means in the time of creating 
the socket and waiting on the server header response, no other thread can request 
a cache resource. See the stacktrace below for details.

In a time where computer and network have a large speed but the latency of internet
connection is large, this is fatal. In our sample (see stacktrace) the loading 
of the splash screen is blocking the loading of the application.

Java Plug-in 1.6.0_17

Verwendung der JRE-Version 1.6.0_17-b04 Java HotSpot(TM) Client VM

Home-Verzeichnis des Benutzers = C:\Dokumente und Einstellungen\rudolfh

 

----------------------------------------------------

c:?? Konsole l????schen

f:?? Objekte in Finalisierungswarteschlange finalisieren

g:?? Speicherbereinigung

h:?? Diese Hilfemeldung anzeigen

l:?? ClassLoader-Liste ausgeben

m:?? Speicherbelegung anzeigen

o:?? Protokollierung ausl????sen

q:?? Konsole ausblenden

r:?? Richtlinien-Konfiguration neu laden

s:?? System- und Bereitstellungseigenschaften ausgeben

t:?? Threadliste ausgeben

v:?? Thread-Stack ausgeben

x:?? ClassLoader-Cache l????schen

0-5: Trace-Stufe auf <n> setzen

----------------------------------------------------

 

Thread-Stack ausgeben...

----------------------------------------------------

2010-02-22 11:07:44

Full thread dump Java HotSpot(TM) Client VM (14.3-b01 mixed mode, sharing):

 

"clientThreads" prio=4 tid=0x032ac800 nid=0x6dc in Object.wait() [0x04d7f000]

?? java.lang.Thread.State: WAITING (on object monitor)

??????? at java.lang.Object.wait(Native Method)

??????? - waiting on <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at java.lang.Object.wait(Object.java:485)

??????? at com.inet.helpdesk.util.ThreadPool.getNextThread(ThreadPool.java:44)

??????? - locked <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at com.inet.helpdesk.util.ThreadPool.access$200(ThreadPool.java:5)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:64)

 

"clientThreads" prio=4 tid=0x04731800 nid=0x1b0 waiting for monitor entry [0x04d2d000]

?? java.lang.Thread.State: BLOCKED (on object monitor)

??????? at com.sun.deploy.cache.DeployCacheHandler.put(Unknown Source)

??????? - waiting to lock <0x1f3e5d80> (a com.sun.deploy.cache.DeployCacheHandler)

??????? at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

??????? - locked <0x1f599e58> (a sun.net.www.protocol.http.HttpURLConnection)

??????? at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)

??????? at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)

??????? at sun.plugin.PluginURLJarFileCallBack$2.run(Unknown Source)

??????? at java.security.AccessController.doPrivileged(Native Method)

??????? at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)

??????? at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)

??????? at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)

??????? at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)

??????? at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)

??????? at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)

??????? at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)

??????? - locked <0x1f59bfd8> (a sun.plugin.net.protocol.jar.CachedJarURLConnection)

??????? at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)

??????? - locked <0x1f59bfd8> (a sun.plugin.net.protocol.jar.CachedJarURLConnection)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader.getJarFile(AsynURLClassLoader.java:223)

??????? - locked <0x1f59c080> (a java.net.URL)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader.findClass(AsynURLClassLoader.java:125)

??????? at java.lang.ClassLoader.loadClass(Unknown Source)

??????? - locked <0x1f4d9268> (a com.inet.helpdesk.loader.AsynURLClassLoader)

??????? at java.lang.ClassLoader.loadClass(Unknown Source)

??????? at java.lang.ClassLoader.loadClassInternal(Unknown Source)

??????? - locked <0x1f4d9268> (a com.inet.helpdesk.loader.AsynURLClassLoader)

??????? at java.lang.ClassLoader.defineClass1(Native Method)

??????? at java.lang.ClassLoader.defineClass(Unknown Source)

??????? at java.security.SecureClassLoader.defineClass(Unknown Source)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader.defineClass(AsynURLClassLoader.java:252)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader.findClass(AsynURLClassLoader.java:130)

??????? at java.lang.ClassLoader.loadClass(Unknown Source)

??????? - locked <0x1f4d9268> (a com.inet.helpdesk.loader.AsynURLClassLoader)

??????? at java.lang.ClassLoader.loadClass(Unknown Source)

??????? at java.lang.ClassLoader.loadClassInternal(Unknown Source)

??????? - locked <0x1f4d9268> (a com.inet.helpdesk.loader.AsynURLClassLoader)

??????? at inet.HelpDeskClient.loadDialogSettings(HelpDeskClient.java:1584)

??????? at com.inet.helpdesk.loader.JobHandler.executeJob(JobHandler.java:133)

??????? at com.inet.helpdesk.loader.JobHandler.run(JobHandler.java:97)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:66)

 

"clientThreads" prio=4 tid=0x03279c00 nid=0x84 in Object.wait() [0x04cdf000]

?? java.lang.Thread.State: WAITING (on object monitor)

??????? at java.lang.Object.wait(Native Method)

??????? - waiting on <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at java.lang.Object.wait(Object.java:485)

??????? at com.inet.helpdesk.util.ThreadPool.getNextThread(ThreadPool.java:44)

??????? - locked <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at com.inet.helpdesk.util.ThreadPool.access$200(ThreadPool.java:5)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:64)

 

"clientThreads" prio=4 tid=0x047aa400 nid=0xb5c waiting for monitor entry [0x04c8f000]

?? java.lang.Thread.State: BLOCKED (on object monitor)

??????? at inet.HelpDeskClient.loadUserData(HelpDeskClient.java:2077)

??????? at inet.HelpDeskClient.setClientUserName(HelpDeskClient.java:2212)

??????? at com.inet.helpdesk.loader.JobHandler.loadServerProperteySettings(JobHandler.java:218)

??????? at com.inet.helpdesk.loader.JobHandler.executeJob(JobHandler.java:110)

??????? at com.inet.helpdesk.loader.JobHandler.run(JobHandler.java:97)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:66)

 

"Konnekter Ping" daemon prio=4 tid=0x04725400 nid=0xed8 in Object.wait() [0x045bf000]

?? java.lang.Thread.State: TIMED_WAITING (on object monitor)

??????? at java.lang.Object.wait(Native Method)

??????? - waiting on <0x1f558720> (a java.util.Vector)

??????? at com.inet.jj.cli.a.run(Unknown Source)

??????? - locked <0x1f558720> (a java.util.Vector)

??????? at java.lang.Thread.run(Unknown Source)

 

"clientThreads" prio=4 tid=0x04742400 nid=0xf14 in Object.wait() [0x04c3f000]

?? java.lang.Thread.State: WAITING (on object monitor)

??????? at java.lang.Object.wait(Native Method)

??????? - waiting on <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at java.lang.Object.wait(Object.java:485)

??????? at com.inet.helpdesk.util.ThreadPool.getNextThread(ThreadPool.java:44)

??????? - locked <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at com.inet.helpdesk.util.ThreadPool.access$200(ThreadPool.java:5)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:64)

 

"Image Loader" daemon prio=4 tid=0x032c7400 nid=0x7b4 runnable [0x04bef000]

?? java.lang.Thread.State: RUNNABLE

??????? at java.net.SocketInputStream.socketRead0(Native Method)

??????? at java.net.SocketInputStream.read(Unknown Source)

??????? at java.io.BufferedInputStream.fill(Unknown Source)

??????? at java.io.BufferedInputStream.read1(Unknown Source)

??????? at java.io.BufferedInputStream.read(Unknown Source)

??????? - locked <0x1f5f6600> (a java.io.BufferedInputStream)

??????? at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)

??????? at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)

??????? at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

??????? - locked <0x1f5f66a0> (a sun.net.www.protocol.http.HttpURLConnection)

??????? at com.sun.deploy.net.HttpUtils.followRedirects(Unknown Source)

??????? at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)

??????? at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(Unknown Source)

??????? at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)

??????? at com.sun.deploy.cache.DeployCacheHandler.get(Unknown Source)

??????? - locked <0x1f3e5d80> (a com.sun.deploy.cache.DeployCacheHandler)

??????? at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)

??????? at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)

??????? at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

??????? - locked <0x1f549060> (a sun.net.www.protocol.http.HttpURLConnection)

??????? at java.net.URL.openStream(Unknown Source)

??????? at com.inet.helpdesk.plugin.LazyIcon.loadSynchron(LazyIcon.java:96)

??????? at com.inet.helpdesk.plugin.LazyIcon.access$000(LazyIcon.java:34)

??????? at com.inet.helpdesk.plugin.LazyIcon$2.run(LazyIcon.java:84)

??????? at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

??????? at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

??????? at java.lang.Thread.run(Unknown Source)

 

"clientThreads" prio=4 tid=0x047a1400 nid=0x984 waiting for monitor entry [0x04b9f000]

?? java.lang.Thread.State: BLOCKED (on object monitor)

??????? at com.inet.helpdesk.loader.JobHandler.executeJob(JobHandler.java:136)

??????? at com.inet.helpdesk.loader.JobHandler.run(JobHandler.java:97)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:66)

 

"clientThreads" prio=4 tid=0x0334f400 nid=0xeb0 in Object.wait() [0x04b4f000]

?? java.lang.Thread.State: WAITING (on object monitor)

??????? at java.lang.Object.wait(Native Method)

??????? - waiting on <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at java.lang.Object.wait(Object.java:485)

??????? at com.inet.helpdesk.util.ThreadPool.getNextThread(ThreadPool.java:44)

??????? - locked <0x1f54c4a0> (a com.inet.helpdesk.util.ThreadPool)

??????? at com.inet.helpdesk.util.ThreadPool.access$200(ThreadPool.java:5)

??????? at com.inet.helpdesk.util.ThreadPool$WorkerThread.run(ThreadPool.java:64)

 

"Thread-12" prio=4 tid=0x03266400 nid=0xf90 waiting for monitor entry [0x042bf000]

?? java.lang.Thread.State: BLOCKED (on object monitor)

??????? at com.sun.deploy.cache.DeployCacheHandler.put(Unknown Source)

??????? - waiting to lock <0x1f3e5d80> (a com.sun.deploy.cache.DeployCacheHandler)

??????? at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

??????? - locked <0x1f50e4d8> (a sun.net.www.protocol.http.HttpURLConnection)

??????? at sun.plugin.PluginURLJarFileCallBack.downloadJAR(Unknown Source)

??????? at sun.plugin.PluginURLJarFileCallBack.access$000(Unknown Source)

??????? at sun.plugin.PluginURLJarFileCallBack$2.run(Unknown Source)

??????? at java.security.AccessController.doPrivileged(Native Method)

??????? at sun.plugin.PluginURLJarFileCallBack.retrieve(Unknown Source)

??????? at sun.net.www.protocol.jar.URLJarFile.retrieve(Unknown Source)

??????? at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)

??????? at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)

??????? at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)

??????? at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(Unknown Source)

??????? at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(Unknown Source)

??????? - locked <0x1f510640> (a sun.plugin.net.protocol.jar.CachedJarURLConnection)

??????? at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)

??????? - locked <0x1f510640> (a sun.plugin.net.protocol.jar.CachedJarURLConnection)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader.getJarFile(AsynURLClassLoader.java:223)

??????? - locked <0x1f5106e8> (a java.net.URL)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader.access$100(AsynURLClassLoader.java:32)

??????? at com.inet.helpdesk.loader.AsynURLClassLoader$BackgroundLoader.run(AsynURLClassLoader.java:376)

??????? at java.lang.Thread.run(Unknown Source)

 

"TimerQueue" daemon prio=4 

Trace message truncated for length over 10K

                                    

Comments
EVALUATION

DeployCacheHandler is too strict regarding concurrent processing.

We need to make sure locks are per URI, i.e. we do not want requests for the same URL to be processed concurrently
but we want different URLs to be processed concurrently.

The former is only importnat for get(), for put() we do not need synchronization at all.

One caveat here is that get() implementation may cause network update check and this will result in recursive call to get().
We can protect against this using ThreadLocal variable that can be used to detect recursive requests in the same thread.
                                     
2010-02-26
SUGGESTED FIX

Webrevs: http://sa.sfbay.sun.com/projects/deployment_data/6u20/6929021.1
Regression test: test/common/com/sun/deploy/cache/CacheHandlerTest.java
                                     
2010-02-27



Hardware and Software, Engineered to Work Together