JDK-6788906 : Applet is freezed when JSObject.getWindow()/call() is used with a large amount of string data
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u10,6u11-rev
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2008-12-24
  • Updated: 2010-11-03
  • Resolved: 2009-05-13
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.
6u14 b01Fixed
Related Reports
Duplicate :  
When string object with the size of about 5 M-bytes is submitted, Applet is freezed with such a "JVM heartbeat .. dead, send ts:  6323053543, now ts: 6333053288, dT 9999745" message.


OS: Windows XP SP2
Browser: IE6/IE7
JRE: 6u10/6u11

1. Make "test" directory and change the directory
2. Save the following codes
3. Compile the following java code (with -classpath "C:\Program Files\Java\jdk1.6.0_10\jre\lib\plugin.jar")
4. Create TestApplet.jar with test\TestApplet$1.class and test\TestApplet.class
5. Run the following HTML code
6. Input "5" as the data size in Applet



Such a "JVM heartbeat" message does not appear like JRE 6u07.


When string object with the size of about 5 M-bytes is submitted, Applet is freezed with such a "JVM heartbeat .. dead, send ts:  6323053543, now ts: 6333053288, dT 9999745" message.

OUTPUT (Java Console)     xxx: Japanese
basic: xxxxxxxxxxxxxxxxxxxxxxxxxx: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@152544e
basic: xxxxxxxxxxxxxxxxxxxxxx
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 689351 us, pluginInit dt 2999658 us, TotalTime: 3689009 us
basic: Applet initialized
basic: xxxxxxxxxxxxxxxxxxxxxxxxxx: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@152544e
basic: Applet made visible
basic: Starting applet
basic: Applet started
basic: Told clients applet is started
Write size : 5242880 byte
Start : Thu Dec 18 22:56:32 JST 2008
JVM heartbeat .. dead, send ts: 48285414798, now ts: 48295408592, dT 9993794 

For the following source code, "JVM heartbeat" message is always displayed when the value of 5M or more is input, while Java Plug-in 2 is available.

---------- BEGIN SOURCE ----------
package test;

import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import javax.swing.*;

import netscape.javascript.JSObject;

public class TestApplet extends JApplet {

  int size = 1;
  JTextField inpText=new JTextField(2);
  private static final long serialVersionUID = 1L;
  public TestApplet() throws HeadlessException {
  public void init() {
    JPanel p1=new JPanel();
    p1.setBackground(new Color(0xFFFFFF));
    JButton btn=new JButton("exe");
    btn.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
    p1.add(new JTextArea("size : "));
    p1.add(new JTextArea("M  "));


  public void execute() {
        JSObject win = JSObject.getWindow(this);
        int sizeWrite = Integer.valueOf(inpText.getText()).intValue();

        size = sizeWrite * 1048576;
        StringBuffer stringBuffer = new StringBuffer(size);
        for (int i1 = 0; i1 < size; i1++) {
        System.out.println("Write size : " + size +" byte");
        System.out.println("Start : " + new Date());
        win.call("setResultXml", new Object[]{stringBuffer.toString()});
        System.out.println("Done  : " + new Date());
---------- END SOURCE ------------

---------- BEGIN HTML-SOURCE ----------


<SCRIPT type="text/javascript">
function setResultXml(resultXml) {



<h1>LiveConnect Write Test</h1>

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
     width="200" height="100" align="baseline">
     <PARAM NAME="code" VALUE="test.TestApplet.class">
     <PARAM NAME="codebase" VALUE=".">
     <PARAM NAME="type" VALUE="application/x-java-applet">
     <PARAM NAME="archive" VALUE="TestApplet.jar">
        No JRE support for APPLET !
<FORM name="testForm">
  <INPUT type="hidden" name="testItem">

---------- END HTML-SOURCE ------------

Bug WorkaroundWhen Java Plug-in 2 option is not checked, the above test program works normally.

SUGGESTED FIX webrev: http://sa.sfbay.sun.com/projects/deployment_data/6u14/6788906.0 testcase: http://j2se.east.sun.com/deployment/www/tests/1.6.0_14/6788906/

EVALUATION This problem is the dual of 6786860, where the in-browser JVM runs out of memory, only in the Java-to-JavaScript direction. Because the failure occurs during deserialization of the message initiating the Java-to-JavaScript call, there is no extra copy of the data to eliminate. The fix for this issue is to increase the heap size of the in-browser JVM on all platforms. It is unfortunately very difficult to trap this error and return an error condition to the calling JVM because of how the message passing subsystem works. No attempt to make this error handling generally more robust has been made with this fix.

EVALUATION This is the dual problem of 6786860, but in the Java -> JavaScript direction rather than JavaScript -> Java.