United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7179509 : IE/Java Plugin freezes by dynamically creating an applet since Java 7 update 4

Details
Type:
Bug
Submit Date:
2012-06-25
Status:
Closed
Updated Date:
2014-01-06
Project Name:
JDK
Resolved Date:
2012-07-18
Component:
deploy
OS:
windows_7
Sub-Component:
plugin
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:
Duplicate:
Duplicate:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b22)
Java HotSpot(TM) Client VM (build 23.0-b21, mixed mode, sharing)

java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) Client VM (build 23.1-b03, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
Microsoft Windows [Version 6.1.7601]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Internet Explorer 7, 8, 9.

A DESCRIPTION OF THE PROBLEM :
When creating an applet dynamically in Internet Explorer (e.g. by Javascript in an html page) by using the <applet> tag the 1st time the applet is loaded the applet and browser are working fine. If one reloads this page and loads the applet a 2nd time the browser or Java Plugin freezes. The only solution in this case is to kill the browser process.

This behavior only depends on the usage of the applet html tag. If you use e.g <object> the browser / plugin will not freeze.

REGRESSION.  Last worked in version 7

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. ) Load html page wich dynamically creates an applet
2.) 1st time the applet is loaded successfully
3.) Press F5 in Internet Explorer to reload the page
4.) Load the applet a 2nd time


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Java Applet is loaded correctly and is ready to work with.
ACTUAL -
Browser / Java Plugin freezes.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
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
basic: Fortschritts-Listener entfernt: sun.plugin.util.ProgressMonitorAdapter@1bdbf51
plugin2manager.parentwindowDispose

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Compile this small class

import java.applet.Applet;
import java.awt.Graphics;
 
public class HelloWorldApplet extends Applet
{ 
  public void paint( Graphics graphic )
  {
    graphic.drawString( "Hello World!", 50, 25 );
  }
}

Then use this html page in IE. To load the applet press the button "Create Applet".
<!DOCTYPE html>
<html>
	<head>
		<script src="http://code.jquery.com/jquery-latest.js"></script>
		<script type="text/javascript">
		
			$(document).ready(function () {
				$('#button').click(function () {
					$.ajax({
						url: './applet.html',
						success: function(data) {
							$('#cave').html(data);
						}
					});
				});
			});
		</script>
	</head>
	<body>
		<button id="button" type="button">Create Applet</button>
		<div id="cave" width="220" height="120">
		</div>
	</body>
</html>



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

CUSTOMER SUBMITTED WORKAROUND :
1.) Do not install Java 7  update 4+
2.) Do use <object> Tag instead of <applet>

                                    

Comments
Verified ok with jdk8 b118, using test class/html in the bug report.
                                     
2014-01-06
EVALUATION

On page reload, same instance of cAxControl and hence IExplorerPlugin can be reused by IE. 
Therefore, we need to reset the object state to allow the next applet to start (when we destroy previous instance).
All calls are executed on the same thread, so race condition is not possible here.

Fix is to reset the gotInitialSize boolean and empty the runnable queue. The invokeLater method checks if the runnable queue is empty before calling into native to process the maybeStartApplet() call.
                                     
2012-07-12
WORK AROUND

Use <object>tag instead of <applet> tag.
                                     
2012-07-02
EVALUATION

When the hang occurs, the client vm is in the process of destroying thread group and AppContext.
    Applet2Manager executing destroyTGAndAC() for entry file:/C:/Bugs/7179509/

The browser vm is processing SetObjectRects which involves sending a message to the client vm but the client vm was busy doing the above operation.
                                     
2012-07-02



Hardware and Software, Engineered to Work Together