Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6917878

[Regression] Applet is freezed when JSObject.getWindow()/call() is used with a large amount of strin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • P3
    • None
    • 6u18
    • deploy
    • x86
    • windows_xp

    Description

      Bug Description: description:

      [Regression for ID.6788906]
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6788906

      When string object with the size of about 6 M-bytes is submitted, Applet is freezed with
      such a "JVM heartbeat .. dead, send ts: 4300380568, now ts: 4310395675, dT 10015107"
      message, or Applet is freezed with closing Java Console window.

      - STEPS TO FOLLOW TO REPRODUCE THE PROBLEM:

      OS: Windows XP SP2
      Browser: IE6/IE7
      JRE: 6u18

      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_18\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 "6" as the data size in Applet


      - EXPECTED VERSUS ACTUAL BEHAVIOR:

      EXPECTED:

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

      ACTUAL:

      When string object with the size of about 6 M-bytes is submitted, Applet is freezed with
      such a "JVM heartbeat .. dead, send ts: 4300380568, now ts: 4310395675, dT 10015107"
      message, or Applet is freezed with closing Java Console window.

      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 217738 us, pluginInit dt 255046 us, TotalTime: 472784 us
      basic: Applet initialized
      basic: xxxxxxxxxxxxxxxxxxxxxxxxxx: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@183f74d
      basic: Applet made visible
      basic: Starting applet
      basic: completed perf rollup
      basic: Applet started
      basic: Told clients applet is started
      Write size : 6291456 byte
      Start : Mon Jan 18 10:16:09 JST 2010
      JVM heartbeat .. dead, send ts: 4300380568, now ts: 4310395675, dT 10015107
       
      ----------------------------------------------------------------------------

      For the following source code, "JVM heartbeat" message is always displayed
      when the value of 6M 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));
          this.getContentPane().add(p1);
          inpText.setText(String.valueOf(size));
          JButton btn=new JButton("exe");
          btn.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                  execute();
              }
          });
          p1.add(new JTextArea("size : "));
          p1.add(inpText);
          p1.add(new JTextArea("M "));
          p1.add(btn);
          
        }

        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++) {
                stringBuffer.append('a');
              }
              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 ----------
      <HTML>

      <HEAD>

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

      </HEAD>

      <BODY>

      <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">
           <PARAM NAME="MAYSCRIPT" VALUE="true">
              No JRE support for APPLET !
      </OBJECT>
      <FORM name="testForm">
        <INPUT type="hidden" name="testItem">
      </FORM>

      </BODY>
      </HTML>
      ---------- END HTML-SOURCE ------------
      Bug WorkaroundWhen Java Plug-in 2 option is not checked, the above test program works normally.

      Attachments

        Activity

          People

            ccheung Calvin Cheung
            xiaojuzh Xiaojun Zhang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: