JDK-6688396 : Exception getting thrown on refreshing the applets and JVM fails to start sometimes
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows
  • CPU: generic
  • Submitted: 2008-04-14
  • Updated: 2010-09-08
  • Resolved: 2008-05-19
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
6u10 b23Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
With latest nightly bundles(dated apr 14) regression in behavior of applets has been noticed when browser/page is refreshed or reloaded. Following exception are getting thrown and applets fails/JRE fails to re-start on certain occasions. Bug can be reproduced with applets using or not using JNLP support
- Install JRE(bundle dated Apr-14)
- Try loading following applets. Try to refresh and reload them
Simple applets not using JNLP:
------------------------------
http://sqeweb.sfbay.sun.com/deployment2/jitu/plug-bug/ALC/JOptionPaneTest.html
http://sqeweb.sfbay.sun.com/deployment2/jitu/plug-bug/ALC/PrintThread.html
http://sqeweb.sfbay.sun.com/deployment2/jitu/plug-bug/ojiliveconnect/src/JSAppletCommunication.html

Simple applets using JNLP:
-------------------------
http://nicole1.sfbay.sun.com:8080/plugin_tests/JNLPSupport/AppletLifecycle/htmls/PrintThread1.html
http://nicole1.sfbay.sun.com:8080/plugin_tests/JNLPSupport/applets/AppletBasics/JNLPBasicS
ervice1-jnlp-applet-abs.html

If you can notice any of the following exception getting raised and applet fails to relaod then bug is reproduced
1)
java.lang.NullPointerException
at sun.plugin2.applet.JNLP2Manager.storeJarVersionMapInAppContext(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.prepareLaunchFile(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException

2)
Exception in thread "AWT-EventQueue-33" java.lang.InternalError: couldn't create component peer
at sun.awt.windows.WComponentPeer.checkCreation(Unknown Source)
at sun.awt.windows.WComponentPeer.<init>(Unknown Source)
at sun.awt.windows.WCanvasPeer.<init>(Unknown Source)
at sun.awt.windows.WPanelPeer.<init>(Unknown Source)
at sun.awt.windows.WWindowPeer.<init>(Unknown Source)
at sun.awt.windows.WFramePeer.<init>(Unknown Source)
at sun.awt.windows.WEmbeddedFramePeer.<init>(Unknown Source)
at sun.awt.windows.WToolkit.createEmbeddedFrame(Unknown Source)
at sun.awt.windows.WEmbeddedFrame.addNotify(Unknown Source)
at sun.awt.windows.WEmbeddedFrame.<init>(Unknown Source)
at sun.plugin2.main.client.PluginEmbeddedFrame.<init

3)
java.nio.channels.OverlappingFileLockException
at sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(Unknown Source)
at sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(Unknown Source)
at sun.nio.ch.FileChannelImpl.lock(Unknown Source)
at com.sun.deploy.cache.CacheEntry.lockFile(Unknown Source)
at com.sun.deploy.cache.CacheEntry.readIndexFile(Unknown Source)
at com.sun.deploy.cache.CacheEntry.access$000(Unknown Source)
at com.sun.deploy.cache.CacheEntry$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)

4)
com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://nicole1.sfbay.sun.com:8080/plugin_tests/JNLPSupport/AppletLifecycle/classes/PrintThreadTest.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(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 sun.plugin2.applet.JNLP2Manager.prepareToLaunch(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain$StartAppletRunner.run(Unknown Source

5)netscape.javascript.JSException
	at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.doMemberOp(Unknown Source)
	at sun.plugin2.main.client.MessagePassingJSObject.getMember(Unknown Source)
	at JSAppletsComm.init(JSAppletsComm.java:31)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InterruptedException
	at java.lang.Object.wait(Native Method)
	at sun.plugin2.message.Queue.waitForMessage(Unknown Source)
	at sun.plugin2.message.Pipe.receive(Unknown Source)
	... 6 more
basic: Applet initialized
java.lang.Exception: comp is null
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Comments
SUGGESTED FIX While stress testing the reload behavior, I have encountered a few bugs. All were related to pending start-applet process, where the user has already initiated applet.stop(). The major errorneous behavior was: - CacheEntry.lockFile() No RandomAccessFile re-open trial if closed. This is fixed while replacing 'lockFile()' with 'openLockIndexFile()' - Plugin2Manager.AppletExecutionRunnable The 'shouldStop' case was not considered enough, e.g. the finally block shall exit quietly in case of shouldStop. - AnimationPanel Shall not disturb the process flow, in case getGraphicsConfiguration() returns null. - .. These failures could be triggered by pressing the reload button 2 times, where the 2nd time should be before the applet has been started. +++ While testing the new Cach lock, it occured that the JavaWS UI CacheTable call of removeAllCacheEntries() is invalid. Added Cache.removeDuplicateEntries() methods, to supply a proper way to remove duplicate entries. This is being used in the JavaWS UI CacheTable and in the Cache CleanupThread. +++ JREInfo: - use the executable path
17-04-2008

EVALUATION Overall, it is true that there exist a bad behavior regarding exception, which even hinders applets (pure and jnlp) to re-start properly. Evaluation of each exception: 1) java.lang.NullPointerException at sun.plugin2.applet.JNLP2Manager.storeJarVersionMapInAppContext(Unknown Source) - Couldn't reproduce, but added a bullet proof test in storeJarVersionMapInAppContext. 2) Exception in thread "AWT-EventQueue-33" java.lang.InternalError: couldn't create component peer at sun.awt.windows.WComponentPeer.checkCreation(Unknown Source) - Couldn't reproduce 3) java.nio.channels.OverlappingFileLockException at sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(Unknown Source) - This is not a bug, but an expected behavior. Added a different Trace log to it, removed the exception, added a semantic trace entry. 4) com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://nicole1.sfbay.sun.com:8080/plugin_tests/JNLPSupport/AppletLifecycle/classes/PrintThreadTest.jnlp at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) - Couldn't reproduce 5)netscape.javascript.JSException at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source) basic: Applet initialized java.lang.Exception: comp is null at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source) - Reproduced, but not a bug, just an applet start/stop race condition, which is expected. Added another bullet proof 'shouldStop' check.
17-04-2008