Name: gm110360 Date: 05/27/2004
FULL PRODUCT VERSION :
Java(TM) Plug-in: Version 1.4.2_03
Using JRE version 1.4.2_03 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\amilkowski
Proxy Configuration: Manual Configuration
Proxy:
Proxy Overrides:
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
1. Applet creates a thread
2. Navigation to a page without applet tag (i.e google.com) throws ThreadDeath exception in
the run method of this thread
3. Applet tries to restart thread, restart does not succeed, thread
does not show up in the thread list (used -t command in SUN JVM
console)
4. hitting browser back button to the page tagged with the applet tag
after step 4 browser will freeze requiring ctrl-alt-del
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. load index.html
2. navigate to google.com (using href link in index.html)
3. use browser back button
(you might potentially repeat step 1 thru 3 couple times, if/when
problem does not occur during first try)
after step 3, browser freeze occurs requiring killing iexplorer task
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
thread restart should succeed after ThreadDeath and not cause
browser freeze on subsequent navigation
ACTUAL -
thread restart after ThreadDeath cause browser freeze on subsequent navigation
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
applet source code:
import java.applet.*;
public class Applet1 extends Applet implements Runnable {
private static int appletCount = 0;
private String threadName="";
private Thread appletThread = null;
private Thread testThread = null;
private boolean stopTestThread = false;
public void init() {
threadName = "Applet1-" + (++appletCount);
}
public void start() {
appletThread = new Thread(this, threadName+"-Run");
appletThread.setDaemon(false);
appletThread.start();
}
public void run() {
startTestThread();
}
public void stop() {
if (appletThread != null) {
try {
appletThread.join();
} catch(Exception e) {
}
appletThread = null;
}
}
public void destroy() {
}
public void startTestThread() {
System.out.println("Starting TestThread");
testThread = new TestThread("TestThread" + appletCount);
testThread.setDaemon(true);
testThread.setPriority(Thread.NORM_PRIORITY - 1);
synchronized (testThread) {
testThread.start();
}
}
class TestThread extends Thread {
public TestThread(String name) {
super(name);
}
public void run() {
try {
while(!stopTestThread) {
if (stopTestThread)
break;
}
} catch(ThreadDeath td) {
System.out.println("Thread Death in run method of TestThread");
startTestThread();
} catch(Exception e) {
System.out.println("Exception: " + e);
}
}
}
}
html page 1 source code:
<HTML>
<HEAD>
<H1><FONT COLOR="FF0000">PAGE 1</FONT></H1>
<H2><U><A href="index2.html" target="_top">Go to next page</A></U></H2>
<H2><U><A href="http://www.google.com" target="_top">google.com</A></U></H2>
</HEAD>
<BODY>
<applet code=Applet1 name=Applet1 width=1 height=1 align=baseline>
</BODY>
</HTML>
html page 2 source code:
<HTML>
<HEAD>
<H1><FONT COLOR="FF0000">PAGE 2</FONT></H1>
<H2><U><A href="index.html" target="_top">Go to next page</A></U></H2>
<H2><U><A href="http://www.google.com" target="_top">google.com</A></U></H2>
</HEAD>
<BODY>
<applet code=Applet1 name=Applet1 width=1 height=1 align=baseline>
</BODY>
</HTML>
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
remove thread restart after ThreadDeath
(Incident Review ID: 270095)
======================================================================