JDK-6185367 : 100% cpu usage when calling Java/Javascript invovling HTML repaint.
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2004-10-27
  • Updated: 2010-04-02
  • Resolved: 2004-10-28
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.
Other
5.0Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)

ADDITIONAL OS VERSION INFORMATION :
Windows 2000 - all MS updates applied

A DESCRIPTION OF THE PROBLEM :

Running the attached testcase resulting in the CPU sitting at 100 usage and IE locking up.

The test case involves calling from Java to JavaScript, which inserts a HTML 'Select' Element.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :

Press CTL-Alt-Del and minize to show the CPU usage in the task bar.

Click on the HTML file to load the file into IE.
Click on the button and watch the CPU usage.

Right click on the IE icon in the task bar to release the CPU and unlock IE.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -

Was not expecting CPU to lock at 100%.
Was not expecting IE to lock up.
ACTUAL -

Expecting a select option to repaint correctly.
Expecting CPU not to reach 100 usuage.
Expecting IE not to lock up.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
// SOURCE CODE & HTML INCLUDED....

import netscape.javascript.JSObject;

import javax.swing.JApplet;
import java.util.List;
import java.util.ArrayList;

public class TestApplet extends JApplet
{
	public List foo() throws InterruptedException
	{
		Thread.sleep(1000);
		JSObject.getWindow(this).call("reenter",new Object[]{System.currentTimeMillis()+""});
		Thread.sleep(1000);
		ArrayList ret = new ArrayList();
		ret.add(new String(System.currentTimeMillis()+""));
		System.out.println(ret);
		return ret;
	}
}





/// ********************************************************************
<HTML>
	<HEAD>
		<SCRIPT TYPE="text/javascript" language="JavaScript">
			function onClickTestButton()
			{
				var _applet = window.document.body.all.testApplet;
				var table = document.body.all.test;
				while (table.rows.length>0)
				{
					table.deleteRow(0);
				}
				var row = table.insertRow();
				var cell = row.insertCell(0);
				cell.innerHTML ="<select size='10' id='testSelect'></select>";
				var selectElement = document.getElementById('testSelect');
				var opt = document.createElement("option");
				opt.text = _applet.foo();
				selectElement.options.add(opt);
			}

			function reenter(test)
			{
				alert(test);
			}

		</SCRIPT>
	</HEAD>
	<BODY>
		<table id="test"></table>
		<button onClick="onClickTestButton()">click here first</button>
		<OBJECT ID="testApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0" WIDTH = "0" HEIGHT = "0" >
			<PARAM NAME="name" VALUE="testApplet"></PARAM>
			<PARAM NAME="CODE" VALUE = "TestApplet.class" ></PARAM>
			<PARAM NAME="type" VALUE = "application/x-java-applet;jpi-version=1.4.2"></PARAM>
			<PARAM NAME="scriptable" VALUE = "true"></PARAM>
		</OBJECT>
	</BODY>
</HTML>

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

CUSTOMER SUBMITTED WORKAROUND :
None.

Clicking on the IE icon in the task bar releases the CPU from its locked state.
###@###.### 10/27/04 18:51 GMT