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

Regression: applet.destroy() is interrupted with jdk 6u10, run into completion with 6u7

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b08
    • CPU:
      x86
    • OS:
      windows
    • Verification:
      Verified

      Backports

        Description

        This is radiance case 66207990.
        There is a difference in behavior between different jdk6 update release
        in applet.destroy() is called when browser is closed.

        With 6u7, destroy() can run into completion, whereas with 6u10,
        destory() is interrupted before the it is finished.

        This could post a problem for cleaning up resources.


        Steps to run the testcase (attached)
        --------------------------
        a. Copy the files to the document root of a web server.
        b. Compile TestApplet.java
        c. Load test.html on a browser.
        d. Open the java console

        After the applet is loaded, close the browser. When jre 6u7 is used, the
        java console will have the following output :
        Inside init
        Inside start
        Inside stop
        Inside destroy
        Before waitObj wait
        After waitObj wait
        Exiting destroy

        When jre 6u10 is used, java console shows the following output :
        Inside init
        Inside start
        Inside stop
        Inside destroy
        Before waitObj wait
        java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at TestApplet.destroy(TestApplet.java:30)
        at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown
        Source)
        at java.lang.Thread.run(Unknown Source)
        Exiting destroy

        I read through the document at
        http://java.sun.com/developer/technicalArticles/javase/java6u10/
        and the release notes at https://jdk6.dev.java.net/plugin2/

        There is a note that says
        "Improved applet lifecycle management. Calls to the applet lifecycle methods
        init, start, stop, and destroy are more deterministic and cross-browser
        behavior has been improved. "

        But there is no specific information on what changes developers should expect
        and code accordingly.
        We have tested the disable of the "next-generation java plugin" already with the provided testcase and it did not solve the problem.

        import java.applet.*;

        public class TestApplet extends Applet {
         
          public void init()
          {
              System.out.println("Inside init");
          }
            public void start()
          {
              System.out.println("Inside start");
          }
            public void stop()
          {
              System.out.println("Inside stop");
          }

          public void destroy()
          {
              System.out.println("Inside destroy");
              Object waitObj = new Object();
                    try
              {
                 synchronized(waitObj)
                 {
                     System.out.println("Before waitObj wait");
                     waitObj.wait(2*60*1000);
                     System.out.println("After waitObj wait");
                 }
              }
              catch(Exception e)
              {
                  e.printStackTrace();
              }
              System.out.println("Exiting destroy");
          }
        }

        <HTML>
        <HEAD></HEAD>
        <BODY >
        <OBJECT classid="clsid:CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA"
                codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_6_0-wind
        ows-i586.cab#Version=1,6,0,10"
                WIDTH="750"
                HEIGHT="600"
                HSPACE="0"
                VSPACE="0"
                ID="">
        <PARAM NAME="TYPE" VALUE="application/x-java-applet;jpi-version=1.6.0_10">

        <PARAM NAME="CODEBASE" VALUE=".">
        <PARAM NAME="CODE" VALUE="TestApplet" >
        <COMMENT>
        <EMBED SRC="" PLUGINSPAGE="http://java.sun.com/products/archive/j2se/6.0_10/inde
        x.html"
                TYPE="application/x-java-applet"
                java_codebase="."
                java_code="TestApplet"
                WIDTH="750"
                HEIGHT="600"
                HSPACE="0"
                VSPACE="0"
                NAME=""
        >
        <NOEMBED>
        </COMMENT>
        </NOEMBED></EMBED>
        </OBJECT>
        </BODY>

        </HTML>

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                karunakar Karunakar Gajjala (Inactive)
                Reporter:
                lkchow Lawrence Chow
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: