JDK-6834128 : should not download applet JNLP file on EventDispatchThread
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u14
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-04-24
  • Updated: 2010-11-03
  • Resolved: 2009-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u17Fixed 7Fixed
Related Reports
Relates :  
Description
browser window is not responsive during initial download of applet JNLP file; this is very noticeable especially when the jnlp file download is very slow due to network issues.

Problem is the initial download of JNLP file happens in EDT:

"AWT-EventQueue-3" prio=4 tid=0x0314ac00 nid=0xbe4 runnable [0x03acf000..0x03acfb60]
  java.lang.Thread.State: RUNNABLE
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(Unknown Source)
   - locked <0x229bba00> (a java.net.SocksSocketImpl)
   at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
   at java.net.PlainSocketImpl.connect(Unknown Source)
   at java.net.SocksSocketImpl.connect(Unknown Source)
   at java.net.Socket.connect(Unknown Source)
   at sun.net.NetworkClient.doConnect(Unknown Source)
   at sun.net.www.http.HttpClient.openServer(Unknown Source)
   at sun.net.www.http.HttpClient.openServer(Unknown Source)
   - locked <0x229bb550> (a sun.net.www.http.HttpClient)
   at sun.net.www.http.HttpClient.<init>(Unknown Source)
   at sun.net.www.http.HttpClient.New(Unknown Source)
   at sun.net.www.http.HttpClient.New(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
   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 <0x229b7e80> (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.actionDownload(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source)
   at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
   at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
   at sun.plugin2.applet.JNLP2Manager.initialize(JNLP2Manager.java:311)
   at sun.plugin2.main.client.PluginMain$StartAppletRunner.run(PluginMain.java:908)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)

Subsequent JAR download happens in a separate applet thread, so it's okay:

"thread applet-SwingSet2Applet-1" prio=4 tid=0x02ad7800 nid=0x8b8 runnable [0x03f3f000..0x03f3fc60]
  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 <0x229b6ee0> (a java.io.BufferedInputStream)
   at sun.net.www.MeteredStream.read(Unknown Source)
   - locked <0x229d36f0> (a sun.net.www.http.KeepAliveStream)
   at java.io.FilterInputStream.read(Unknown Source)
   at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown Source)
   at java.io.BufferedInputStream.read1(Unknown Source)
   at java.io.BufferedInputStream.read(Unknown Source)
   - locked <0x229e46c8> (a java.io.BufferedInputStream)
   at java.io.BufferedInputStream.fill(Unknown Source)
   at java.io.BufferedInputStream.read1(Unknown Source)
   at java.io.BufferedInputStream.read(Unknown Source)
   - locked <0x229eefb8> (a java.io.BufferedInputStream)
   at java.io.FilterInputStream.read(Unknown Source)
   at java.io.PushbackInputStream.read(Unknown Source)
   at java.util.zip.InflaterInputStream.fill(Unknown Source)
   at java.util.zip.InflaterInputStream.read(Unknown Source)
   at java.util.zip.ZipInputStream.read(Unknown Source)
   at com.sun.deploy.net.HttpDownloadHelper.decompressWrite(Unknown Source)
   at com.sun.deploy.net.HttpDownloadHelper.download(Unknown Source)
   at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
   at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
   at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
   at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
   at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
   at sun.plugin2.applet.JNLP2Manager.downloadResources(JNLP2Manager.java:1140)
   at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(JNLP2Manager.java:734)
   at sun.plugin2.applet.JNLP2Manager.loadJarFiles(JNLP2Manager.java:498)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1393)
   at java.lang.Thread.run(Unknown Source)

Comments
EVALUATION JNLP2Manager initialization is done on the event dispatcher thread is because we need create the embedded frame in the right AppContext. The networking on the EDT happens only when the jnlp file itself need update (or redirection). For better performance, we need refactor out only necessary code to run on EDT.
14-05-2009

EVALUATION A fix would involve checking whether the current thread which is downloading the JNLP file is an Event Dispatch Thread. If it is, start a new thread to download the JNLP file and wait for the thread to finish downloading the file.
14-05-2009