JDK-7074440 : Java plugin fails in java7 on page load/reload in IE9
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2011-08-03
  • Updated: 2013-01-08
  • Resolved: 2011-08-24
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 7 JDK 8
7u2 b03Fixed 8Fixed
Description
FULL PRODUCT VERSION :
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]  (Windows 7 SP1, 64bit)

EXTRA RELEVANT SYSTEM CONFIGURATION :
32-bit IE9 and 32-bit Java

A DESCRIPTION OF THE PROBLEM :
Loading a page with an applet will randomly fail to work. From the logfile it looks like the plugin part fails to communicate with the JVM (browser plugin crashed?).

Firefox 4 and 5 did not have this problem on the same machine. Reverting to Java6 makes it work again in IE9. Also tested on Vista/IE8 and there it also works for me.
Was repeatable on a second windows7/IE9 machine.

REGRESSION.  Last worked in version 6u26

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Load/Reload the page a few times (5-10 times max).
Enabling trace/logging seems to make it easier to trigger (looks like a race condition).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No crash.
ACTUAL -
Browser reports "A problem with this webpage caused Internet Explorer to close and reopen the tab" and reloads the page, or sometimes closes it.
I did have a hs_err_pid*.log file but am unsure if that was from testing this. Removed it but were unable to generate a new one so probably not.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Log started: on, 3 aug 2011 12:26:30 +0200
Detected from bootclasspath: C:\\PROGRA~2\\Java\\jre7\\lib\\deploy.jar
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@b1a0f9
network: Cache entry not found [url: http://10.10.120.126:8080/phoenix/ts/sysreq/aa/, version: null]
network: Cache entry found [url: http://10.10.120.126:8080/phoenix/ts/sysreq/aa/Java7.class, version: null] prevalidated=false/0
network: Connecting http://10.10.120.126:8080/phoenix/ts/sysreq/aa/Java7.class with proxy=DIRECT
network: Connecting http://10.10.120.126:8080/ with proxy=DIRECT
network: ResponseCode for http://10.10.120.126:8080/phoenix/ts/sysreq/aa/Java7.class : 304
network: Encoding for http://10.10.120.126:8080/phoenix/ts/sysreq/aa/Java7.class : null
network: Disconnect connection to http://10.10.120.126:8080/phoenix/ts/sysreq/aa/Java7.class
network: Cache entry not found [url: http://10.10.120.126:8080/phoenix/ts/sysreq/aa/, version: null]
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 448759 us, pluginInit dt 3280525 us, TotalTime: 3729284 us
sysreq - init22 done!
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started
basic: Starting applet teardown
basic: Finished applet teardown
plugin2manager.parentwindowDispose
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@b1a0f9
basic: JVM[id=1]-Heartbeat heartbeat dead, exception. dT=4 seconds.
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)
	at sun.plugin2.main.server.HeartbeatThread.run(Unknown Source)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Files available on: http://beta.enlight.net/~puw/java7/java7.html

java7.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Java 7 Applet Test Page</title>
</head>

<body>

  <applet code="Java7">
  </applet>

</body>
</html>

Java7.java:
import java.applet.*;

public class Java7 extends Applet
{
    public void init()
    {
	System.err.println("sysreq - init22 done!");
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Removing the doctype stops the crashes, it changes IE9 to use quirks mode and I guess it does something differently with regard to plugins. This whole thing could be an IE bug.

Comments
EVALUATION With IE9, there's a race condition between the startup thread and the browser main thread calling SetClientSite when the DOCTYPE is specified in the html page embedding an applet. The crash is due to an invalid pluginObject was used in AbstractPlugin::getJavaNameSpace when calling a java method. Instead of waiting for DONE_START in SetClientSite, this new fix is to store the java name space dispatch id in CJavaDispatch. When the dispatch id is needed to invoke a method, get a property, etc., CJavaDispatch will call AbstractPlugin::javaObjectSetField to fully setup the java name space. A wrapper CJavaDispatch::GetJavaPluginInstance() has been added. It waits for the DONE_START state before calling CAxControl::getJavaIExplorerPluginInstance to make sure the pluginObject has been initialized.
19-08-2011

EVALUATION The crash is in AbstractPlugin::getJavaNameSpace when calling a java method "getJavaNameSpace". Attached are: tracing with debug output - IE9_trace.txt windbg log with call stack - IE9_doctype_crash2.txt
09-08-2011

WORK AROUND Remove the following line in the html file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/loose.dtd">
09-08-2011