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

Java Plug-in 1.3.0_01(and upwards) hangs using a background loading thread

    XMLWordPrintable

Details

    • 03
    • x86
    • windows_nt
    • Verified

    Backports

      Description

        Customer Problem Description:
        -----------------------------

        java version "1.3.0_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
        Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)

        =======

        A change in the 1.3.0_01 plugin prevents our application from creating our
        applet's UI on a separate thread of execution. On multiple WinNT systems, the
        plugin deadlocks in the separate thread when it attempts to load the first user
        defined class. This technique has worked correctly in all previous releases of
        the plugin. Our threading approach is simple, standard and sound.

        We have seen this problem on a WinNT SP5 600 Mghz/256 RAM/IE 5.5 and a WinNT
        SP4 400 Mghz/128 RAM/IE 5.5.



        DESCRIPTIONEND
        TESTCASEBEGIN
        I can send source code separately if you need it. The three critical classes are
        KronosApplet, DemoGUIBuildApplet, and BuilderThread:

        // BASE APPLET CLASS

        abstract public class KronosApplet extends JApplet
        implements BuildTask {

        /**
        * Code here executes as quickly as possible to
        * show a white status screen. Time consuming
        * code initialization is done in the background
        * thread.
        */
        public final void init() {
        getContentPane().setLayout(new BorderLayout());

        // disable the UI while we load
        getGlassPane().addMouseListener(new MouseAdapter() {});
        enableUI(false);

        // show a wait screen immediately:
        showWaitMessage();

        // let a background thread create the real display.
                        // Triggers the call to runBackgroundTask(), onLoad()
        startBuildTask(this);
        }

        public void startBuildTask(BuildTask task) {
        if (task == null)
        throw new IllegalArgumentException(
        "No BuildTask supplied");
        BuilderThread builder = new BuilderThread(task);
        builder.start();
        }

        /**
        * As per BuildTask. This executes on a user
        * created thread.
        */
        public final void runBackgroundTask() {
        // Requests subclass to create its
        // display. Time consuming work is done here.
        onLoad();
        }

        /**
        * As per BuildTask. This executes on
        * the AWT Event Queue thread.
        */
        public final void finishTask() {
        swapRoot(_waitPanel, _rootPanel, true);
        _waitPanel = null;
        enableUI(true);
        }

        /**
        * Subclass builds its UI starting with
        * this method.
        */
        abstract public void onLoad();

        protected void setRootPanel(KronosRootPanel root) {
        checkLayout();
        if (null == root)
        throw new IllegalArgumentException(
        "No root panel supplied");
        _rootPanel = root;
        }

        private void showWaitMessage() {
        _waitPanel = new WaitPanel();
        swapRoot(_rootPanel, _waitPanel, false);
        }

        private void swapRoot(Container oldRoot, Container newRoot,
        boolean validate) {
        if (oldRoot != null)
        getContentPane().remove(oldRoot);
        getContentPane().add(newRoot, BorderLayout.CENTER);
        _rootPanel = newRoot;
        if (validate) {
        getRootPane().revalidate();
        getRootPane().repaint();
        }
        }

          // etc....
        }


        // DERIVED CLASS

        public class DemoGUIBuildApplet extends KronosApplet {

        public void onLoad() {
        // What happens right before we load the first class seems
        // to impact the problem. Removing this System.out call
        // prevents the hang from happening on some systems.
        System.out.println("In onLoad");

        // This is the first user defined class loaded in this
        // thread. IF PLUGIN HANGS, IT WILL HANG HERE.
        new DummyClass(); <---- wedges here

        setRootPanel(new DemoGUIBuildRootPanel(this));
        }

        // etc....
        }


        // BACKGROUND THREAD

        public class BuilderThread extends Thread {
        private BuildTask _task;

        public BuilderThread(BuildTask task) {
        _task = task;
        setPriority(Thread.MIN_PRIORITY);
        }

        public void run() {
        _task.runBackgroundTask();
        SwingUtilities.invokeLater(new Runnable() {
        public void run() {
        _task.finishTask();
        }
        });
        }
        }

        We have been able to reproduce this problem on more than one applet. When it
        fails, IT CONSISTENTLY FAILS WHEN LOADING THE FIRST USER DEFINED CLASS FROM A
        USER DEFINED THREAD.

        ===============

        Here's the output of the console trace:

        Java(TM) Plug-in: Version 1.3.0_01
        Using JRE version 1.3.0_01 Java HotSpot(TM) Client VM
          User home directory = C:\WINNT\Profiles\pfarwell


        Proxy Configuration: no proxy





        Dump system properties ...
        ---------------------------------------------------
        application.home = C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0
        awt.toolkit = sun.awt.windows.WToolkit
        bridge.home = C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0
        file.encoding = Cp1252
        file.encoding.pkg = sun.io
        file.separator = java.awt.fonts =
        java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
        java.awt.printerjob = sun.awt.windows.WPrinterJob
        java.class.path = .
        java.class.version = 47.0
        java.ext.dirs = C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0\lib\ext
        java.home = C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0
        java.io.tmpdir = C:\TEMPjava.library.path = C:\Program Files\Plus!\Microsoft
        Internet;.;C:\WINNT\System32;C:\WINNT;C:\PROGRA~1\Plus!\MICROS~1
        \;;C:\WINNT\system32;C:\WINNT;D:\batch;D:\OptimizeIt\OptimizeIt31\lib;D:\MSSQL7
        \BINN;d:\Kronos\wfc\properties
        java.runtime.name = Java(TM) 2 Runtime Environment, Standard Edition
        java.runtime.version = 1.3.0_01
        java.specification.name = Java Platform API Specification
        java.specification.vendor = Sun Microsystems Inc.
        java.specification.version = 1.3
        java.vendor = Sun Microsystems Inc.
        java.vendor.url = http://java.sun.com/
        java.vendor.url.bug = http://java.sun.com/cgi-bin/bugreport.cgi
        java.version = 1.3.0_01
        java.vm.info = mixed mode
        java.vm.name = Java HotSpot(TM) Client VM
        java.vm.specification.name = Java Virtual Machine Specification
        java.vm.specification.vendor = Sun Microsystems Inc.
        java.vm.specification.version = 1.0
        java.vm.vendor = Sun Microsystems Inc.
        java.vm.version = 1.3.0_01
        javaplugin.maxHeapSize = 128m
        javaplugin.nodotversion = 130_01
        javaplugin.trace = true
        javaplugin.trace.option = basic|net|security|ext|liveconnect
        javaplugin.version = 1.3.0_01
        line.separator = \r\n
        os.arch = x86
        os.name = Windows NT
        os.version = 4.0
        path.separator = ;
        sun.boot.class.path = C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0
        \lib\rt.jar;C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0\lib\i18n.jar;C:\PROGRA~1
        \JavaSoft\JRE\13C255~1.0_0\lib\sunrsasign.jar;C:\PROGRA~1
        \JavaSoft\JRE\13C255~1.0_0\classes;C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0
        \lib\jaws.jar;C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0\lib\tools.jar;C:\PROGRA~1
        \JavaSoft\JRE\13C255~1.0_0\lib\plugprov.jar;C:\PROGRA~1
        \JavaSoft\JRE\13C255~1.0_0\lib\sunrsasign.jar
        sun.boot.library.path = C:\PROGRA~1\JavaSoft\JRE\13C255~1.0_0\bin
        sun.cpu.endian = little
        sun.cpu.isalist = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386
        sun.io.unicode.encoding = UnicodeLittle
        trustProxy = true
        user.dir = C:\WINNT\Profiles\pfarwell\Desktop
        user.home = C:\WINNT\Profiles\pfarwell
        user.language = en
        user.name = pfarwell
        user.region = US
        user.timezone =
        ---------------------------------------------------
        Done.


        ----------------------------------------------------
        c: clear console window
        f: finalize objects on finalization queue
        g: garbage collect
        h: display this help message
        l: dump classloader list
        m: print memory usage
        q: hide console
        s: dump system properties
        t: dump thread list
        x: clear classloader cache
        0-5: set trace level to <n>
        ----------------------------------------------------


        Registered modality listener


        Referencing classloader: sun.plugin.ClassLoaderInfo@72e449, refcount=1


        Added trace listener: sun.plugin.ocx.ActiveXAppletViewer
        [com/kronos/wfc/applets/appletdemo/DemoGUIBuildApplet,0,0,737x419,invalid,layout
        =java.awt.BorderLayout]


        Sending events to applet. LOAD


        Sending events to applet. INIT


        Sending events to applet. START


        Determine if the applet requests to install any HTML page


        HTML Installation finished.


        Determine if the applet requests to install any JAR


        Jar cache option: null
        Jar archive(s): null
        Jar cache version(s): null


        Applet Installation finished.


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/applets/appletdemo/DemoGUIBuildAppl
        et.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\DemoGUIBuildApplet[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/baseapplet/KronosAp
        plet.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\KronosApplet[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/utility/BuildTask.c
        lass


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\BuildTask[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/baseapplet/KronosAp
        plet$WaitPanel.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\KronosApplet$WaitPanel[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/utility/BuilderThre
        ad.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\BuilderThread[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/baseapplet/KronosRo
        otPanel.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \WJYV2PQF\KronosRootPanel[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/component/KronosPan
        el.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\KronosPanel[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/applets/appletdemo/DemoGUIBuildRoot
        Panel.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \WJYV2PQF\DemoGUIBuildRootPanel[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/wfp/uiframework/baseapplet/KronosAp
        plet$1.class


        Cache filename: C:\WINNT\Profiles\pfarwell\Temporary Internet Files\Content.IE5
        \QB0PKX6H\KronosApplet$1[1].class


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/applets/appletdemo/DemoGUIBuildAppl
        etBeanInfo.class


        Connecting
        http://pfarwellnt/scratch/lib/com/kronos/wfc/applets/appletdemo/DemoGUIBuildAppl
        etBeanInfo.class with no proxy


        In onLoad


        Opening
        http://pfarwellnt/scratch/lib/com/kronos/wfc/applets/appletdemo/DummyClass.class
         <-- WEDGES HERE


        Removed trace listener: sun.plugin.ocx.ActiveXAppletViewer
        [com/kronos/wfc/applets/appletdemo/DemoGUIBuildApplet,0,0,737x419,layout=java.aw
        t.BorderLayout]
        workaround: None found.

        Attachments

          Issue Links

            Activity

              People

                stanleyh Stanley Ho (Inactive)
                cprasadsunw Ck Prasad (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: