JDK-6391104 : Browser Hang when page with applets refreshed
  • Type: Bug
  • Status: Closed
  • Resolution: Duplicate
  • Component: deploy
  • Sub-Component: plugin
  • Priority: P3
  • Affected Version: 5.0
  • OS: windows_xp
  • CPU: x86
  • Submit Date: 2006-02-27
  • Updated Date: 2010-04-05
  • Resolved Date: 2007-08-21
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
When a page with applets is refreshed frequently, IE hangs. Nothing can be done with IE and IE can be closed only in Task Manager.
I tried with a simple applet and the JSP refreshes with a certain wait time. The Applet gives the following error after some time.
java.lang.NullPointerException
	at sun.plugin.AppletViewer.loadJarFiles(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Later after little more time, the browser freezes to respond.

The hang occurs sooner
1. if there are more number of applets in a page.
2. if the refresh frequency is more (the wait time between refresh is less)
3. if the applet jar file is heavy.
4. if the windows system is busy.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Refresh frequently a page with applets.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No hang in the browser.
ACTUAL -
Browser hang.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
	at sun.plugin.AppletViewer.loadJarFiles(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 always.

---------- BEGIN SOURCE ----------
/*Source code of the applet.
*/
package test;

import javax.swing.JApplet;

public class MyApplet extends JApplet
{
	private static final long serialVersionUID = 1L;

	// Initialize the applet
    public void init()
    {
    	super.init();
    	System.out.println("MyApplet - init()");
    }
    
    public void start() {
    	super.start();
    	System.out.println("MyApplet - start()");
    }
    
    public void stop() {
    	super.stop();
    	System.out.println("MyApplet - stop()");
    }
    
    public void destroy() {
    	super.destroy();
    	System.out.println("MyApplet - destroy()");
    }
}


<%--
Source code of the JSP containing applet.
--%>
<%
Long retryAttempt = (Long)session.getAttribute("attempt");
if(retryAttempt == null)
{
   retryAttempt = new Long(1);
} else
{
   retryAttempt = new Long(retryAttempt.longValue()+1);
}
session.setAttribute("attempt", retryAttempt);
%>
<html>
<head>
<title>Testing Applet Reloaded <%=retryAttempt%></title>
</head>
<body onLoad="setTimeout('document.forms[0].submit()', 100)">
<form>
<input type=submit name="but1" value="Reload">
</form>
<OBJECT classid="clsid:CAFEEFAC-0015-0000-0005-ABCDEFFEDCBA" name="MyApplet" width="50" height="50" align="middle">
  <param name="java_code" value="test.MyApplet">
  <param name="java_codebase" value="/test/applets">
  <param name="type" value="application/x-java-applet;version=1.5.0_05">
  <param name="java_type" value="application/x-java-applet;jpi-version=1.5.0_05">
  <param name="name" value="MyApplet">
  <param name="cache_archive" value="MyApplet.jar">
</OBJECT>
<br><h1>so far <%=retryAttempt%> times</h1>
</body>
</html>
---------- END SOURCE ----------

Comments
EVALUATION we have provided workaround to customer for now. Similar to 4910772/6313927/6313940, this is another instance of the applet life cycle bug, which will be fixed in dolphin by: 6399750: RFE: Improve applet lifecycle and LiveConnect support in Java Plug-in
2006-07-10

WORK AROUND use -Djavaplugin.classloader.cache.enabled=false and turn off "Show applet life cycle exception" in Java control panel.
2006-07-10

EVALUATION the fix we have currently for 4910772/6313927/6313940 is too complicated and risky to putback into mustang or tiger update release. we will need to look for a simpler fix for this hanging issue. java stack trace when the hang occur with 5.0u7 Full thread dump Java HotSpot(TM) Client VM (1.5.0_07-6370565-b02 mixed mode, sh aring): "Thread-5503" prio=6 tid=0x057f33c8 nid=0xedc runnable [0x0fc9f000..0x0fc9fbe8] at sun.plugin.com.DispatchClient.nativeInvoke(Native Method) at sun.plugin.com.DispatchClient.invoke(Unknown Source) at sun.plugin.javascript.ocx.JSObject.invoke(Unknown Source) - locked <0x21a1a470> (a sun.plugin.javascript.ocx.JSObject) at sun.plugin.javascript.ocx.JSObject.getMember(Unknown Source) at sun.plugin.AppletViewer.getDocumentBase(Unknown Source) - locked <0x21a1a490> (a java.lang.Object) at sun.plugin.AppletViewer.getCodeBase(Unknown Source) - locked <0x21a1a498> (a java.lang.Object) at sun.plugin.AppletViewer.createClassLoader(Unknown Source) at sun.plugin.AppletViewer.appletInit(Unknown Source) at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source) at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source) "Thread-5406" prio=6 tid=0x057bc0d0 nid=0xa74 waiting on condition [0x0f56f000.. 0x0f56fc68] at java.lang.Thread.sleep(Native Method) at sun.plugin.util.AnimationPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "thread applet-test.MyApplet2" prio=4 tid=0x0579d408 nid=0xd58 in Object.wait() [0x0262f000..0x0262fae8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at sun.applet.AppletPanel.getNextEvent(Unknown Source) - locked <0x21a01f88> (a sun.plugin.AppletViewer) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "thread applet-test.MyApplet2" prio=4 tid=0x057bd728 nid=0xd64 in Object.wait() [0x0ff9f000..0x0ff9fce8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at sun.applet.AppletPanel.getNextEvent(Unknown Source) - locked <0x219fa1b8> (a sun.plugin.AppletViewer) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "AWT-EventQueue-843" prio=4 tid=0x057c2510 nid=0x614 in Object.wait() [0x1222f00 0..0x1222f9e8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at java.awt.EventQueue.getNextEvent(Unknown Source) - locked <0x219a22c8> (a java.awt.EventQueue) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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) "TimerQueue" daemon prio=4 tid=0x02e29028 nid=0x150 in Object.wait() [0x1212f000 ..0x1212fae8] at java.lang.Object.wait(Native Method) - waiting on <0x219a1f20> (a javax.swing.TimerQueue) at javax.swing.TimerQueue.run(Unknown Source) - locked <0x219a1f20> (a javax.swing.TimerQueue) at java.lang.Thread.run(Unknown Source) "thread applet-test.MyApplet2" prio=4 tid=0x0575a1a8 nid=0xa0 in Object.wait() [ 0x0e90f000..0x0e90fbe8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at sun.applet.AppletPanel.getNextEvent(Unknown Source) - locked <0x2199fcc8> (a sun.plugin.AppletViewer) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "thread applet-test.MyApplet1" prio=4 tid=0x057719d0 nid=0x53c in Object.wait() [0x0fa7f000..0x0fa7fc68] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at sun.applet.AppletPanel.getNextEvent(Unknown Source) - locked <0x2199fe50> (a sun.plugin.AppletViewer) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "AWT-EventQueue-449" prio=4 tid=0x057f67d8 nid=0x400 in Object.wait() [0x0f46f00 0..0x0f46fd68] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at java.awt.EventQueue.getNextEvent(Unknown Source) - locked <0x214f7d48> (a java.awt.EventQueue) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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) "TimerQueue" daemon prio=4 tid=0x057bedd8 nid=0x354 in Object.wait() [0x12c2f000 ..0x12c2fa68] at java.lang.Object.wait(Native Method) - waiting on <0x214f7f00> (a javax.swing.TimerQueue) at javax.swing.TimerQueue.run(Unknown Source) - locked <0x214f7f00> (a javax.swing.TimerQueue) at java.lang.Thread.run(Unknown Source) "thread applet-test.MyApplet2" prio=4 tid=0x02e49d90 nid=0x890 in Object.wait() [0x0fe9f000..0x0fe9fce8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at sun.applet.AppletPanel.getNextEvent(Unknown Source) - locked <0x214f5d80> (a sun.plugin.AppletViewer) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "TimerQueue" daemon prio=6 tid=0x0578d530 nid=0x434 in Object.wait() [0x0e38f000 ..0x0e38fbe8] at java.lang.Object.wait(Native Method) - waiting on <0x21443490> (a javax.swing.TimerQueue) at javax.swing.TimerQueue.run(Unknown Source) - locked <0x21443490> (a javax.swing.TimerQueue) at java.lang.Thread.run(Unknown Source) "AWT-EventQueue-0" prio=6 tid=0x05779e70 nid=0xe5c in Object.wait() [0x061ff000. .0x061ffc68] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at java.awt.EventQueue.getNextEvent(Unknown Source) - locked <0x212f7458> (a java.awt.EventQueue) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.SequencedEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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) "ConsoleWriterThread" daemon prio=6 tid=0x05731368 nid=0xb68 in Object.wait() [0 x060ff000..0x060ffce8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unkn own Source) - locked <0x21360308> (a java.lang.Object) "AWT-EventQueue-1" prio=6 tid=0x05728978 nid=0xb58 runnable [0x05fff000..0x05fff d68] at sun.awt.windows.WComponentPeer._requestFocus(Native Method) at sun.awt.windows.WComponentPeer.requestFocus(Unknown Source) at java.awt.Component.requestFocusHelper(Unknown Source) at java.awt.Component.requestFocusInWindow(Unknown Source) at javax.swing.JComponent.requestFocusInWindow(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.SequencedEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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) "traceMsgQueueThread" daemon prio=6 tid=0x0570ae20 nid=0x1a0 in Object.wait() [0 x05dff000..0x05dffa68] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source) - locked <0x213028f8> (a java.util.ArrayList) at java.lang.Thread.run(Unknown Source) "AWT-Windows" daemon prio=6 tid=0x05704fc8 nid=0x8dc runnable [0x05bef000..0x05b efae8] at sun.awt.windows.WToolkit.eventLoop(Native Method) at sun.awt.windows.WToolkit.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "AWT-Shutdown" prio=6 tid=0x05704b48 nid=0x298 in Object.wait() [0x05aef000..0x0 5aefb68] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at sun.awt.AWTAutoShutdown.run(Unknown Source) - locked <0x213025a0> (a java.lang.Object) at java.lang.Thread.run(Unknown Source) "Java2D Disposer" daemon prio=10 tid=0x05703788 nid=0xfe8 in Object.wait() [0x05 9ef000..0x059efbe8] at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(Unknown Source) - locked <0x21302628> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(Unknown Source) at sun.java2d.Disposer.run(Unknown Source) at java.lang.Thread.run(Unknown Source) "Low Memory Detector" daemon prio=6 tid=0x02e20818 nid=0xed4 runnable [0x0000000 0..0x00000000] "CompilerThread0" daemon prio=10 tid=0x02e1f478 nid=0x8c8 waiting on condition [ 0x00000000..0x054cfa4c] "Signal Dispatcher" daemon prio=10 tid=0x02e1e6d0 nid=0xbcc waiting on condition [0x00000000..0x00000000] "Finalizer" daemon prio=8 tid=0x02e19098 nid=0x664 in Object.wait() [0x052cf000. .0x052cfa68] at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(Unknown Source) - locked <0x213027d0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(Unknown Source) at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source) "Reference Handler" daemon prio=10 tid=0x02dedd78 nid=0xbd0 in Object.wait() [0x 051cf000..0x051cfae8] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source) - locked <0x213024d8> (a java.lang.ref.Reference$Lock) "main" prio=6 tid=0x02d70ec8 nid=0x358 in Object.wait() [0x0013e000..0x0013e5fc] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Unknown Source) at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source) - locked <0x20b95ba8> (a com.sun.deploy.util.DeployAWTUtil$1AWTInvocatio nLock) at sun.plugin.viewer.frame.IExplorerEmbeddedFrame.setBean(Unknown Source ) at sun.plugin.viewer.IExplorerPluginObject.createFrame(Unknown Source) "VM Thread" prio=10 tid=0x02decbf8 nid=0x964 runnable "VM Periodic Task Thread" prio=10 tid=0x02e21b60 nid=0x84c waiting on condition
2006-03-02

EVALUATION this is probably caused by the current applet life cycle, and the way we destroy applets. HelloWorld stop() HelloWorld destroy() basic: Joined applet thread ... basic: Unregistered modality listener HelloWorld finalize() HelloWorld finalize() HelloWorld finalize() basic: Registered modality listener createClassLoader, cli set to: sun.plugin.ClassLoaderInfo@16fd0b7 basic: Referencing classloader: sun.plugin.ClassLoaderInfo@16fd0b7, refcount=5 basic: Added progress listener: sun.plugin.util.GrayBoxPainter@1358f03 basic: Loading applet ... basic: Initializing applet ... basic: Starting applet ... basic: completed perf rollup basic: Stopping applet ... basic: Removed progress listener: sun.plugin.util.GrayBoxPainter@1358f03 basic: Finding information ... basic: Releasing classloader: sun.plugin.ClassLoaderInfo@16fd0b7, refcount=4 createClassLoader, cli set to: null java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Unknown Source) at sun.plugin.AppletViewer.appletDestroy(AppletViewer.java:986) at sun.plugin.AppletViewer.appletDestroy(AppletViewer.java:937) at sun.plugin.viewer.LifeCycleManager.destroyAppletPanel(LifeCycleManager.java:209) at sun.plugin.viewer.IExplorerPluginObject.destroyPlugin(IExplorerPluginObject.java:238) basic: Done ... basic: Joining applet thread ... basic: Destroying applet ... basic: Disposing applet ... basic: Quiting applet ... java.lang.NullPointerException at sun.plugin.AppletViewer.loadJarFiles(AppletViewer.java:1687) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) basic: Exception: java.lang.NullPointerException basic: Joined applet thread ... It seems like during fast page reload, when we destroy the current applet, the loader thread of the new instance of the applet might be already started to load, so sometimes we run into this NPE in the loader thread, since the cli is set of null by the previous applet shutdown sequence code The fix for 4910772/6313927/6313940 might fix this problem too; I will try to test with a bundle containing these fixes and see if it is still reproducible
2006-02-27

EVALUATION i can reproduce the problem with tiger and mustang. Just go to any applet, e.g swingset2, and keep hitting browser refresh button until you see the exception: java.lang.NullPointerException at sun.plugin.AppletViewer.loadJarFiles(AppletViewer.java:1684) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
2006-02-27