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

Solaris JDK 1.1 runtime crashes if mix threads and AWT events

XMLWordPrintable

    • 1.1.6
    • generic, sparc
    • solaris_2.5.1
    • Verified

        GUIThread thread2 = new GUIThread(f, 200, 100);
                        GUIThread thread3 = new GUIThread(f, 300, 100);
                        GUIThread thread4 = new GUIThread(f, 400, 100);
                        GUIThread thread5 = new GUIThread(f, 500, 100);

                        thread1.start();
                        thread2.start();
                        thread3.start();
                        thread4.start();
                        thread5.start();
                }

        }


        class GUIThread
                extends Thread
        {
        boolean visib = false;
                GUIThread(TestFrame f, int x, int y)
                {
                        parentFrame = f;
                        this.x = x;
                        this.y = y;
                }

                public void run()
                {
                        while (true)
                        {
                                try
                                {
                                        parentFrame.pack();
                                        sleep(500);
                                        parentFrame.show();
                                        sleep(500);
                                        parentFrame.setSize(x,y);
                                        sleep(500);
                                        parentFrame.setVisible(false);
                                }
                                catch (Exception e)
                                {
                                }
                        }
                }


                private TestFrame parentFrame;
                private int x;
                private int y;
        }

        class TestFrame
                extends Frame
        {
                public TestFrame()
                {
                        super();
                       setLayout(new FlowLayout());
                        add(new Button("GUI Thread Test1"));
                        add(new Label("Test Label1"));
                        add(new TextField(10));
                        add(new Button("GUI Thread Test2"));
                        add(new Label("Test Label2"));
                        add(new TextField(10));
                        add(new Button("GUI Thread Test3"));
                        add(new Label("Test Label3"));
                        add(new TextField(10));
                        add(new Button("GUI Thread Test4"));
                        add(new Label("Test Label4"));
                        add(new TextField(10));
                }


                public boolean action(Event e, Object arg)
                {
                        if (e.target instanceof Button)
                        {
                                dispose();
                                return true;
                        }
                        return false;
                }

        }
        The application below can crash the Solaris JDK 1.1 runtime on Solaris
        2.5, 2.5.1 and 2.6
        I am informed that the latest JDK 1.1.1 nightly build also
        exhibits the same problem (as of 25th March 1997)

        To reproduce compile & run the example program included below.
        2 threads are created, each of which are creating and destroying
        windows.
        If you then take sight of a button and try hard to click on it, soon
        enough the runtime will crash.
        ^XIf it doesn't just exit the app and restart. It will almost certainly
        happen next time.
        The mouse-clicking seems to be important to make the crash happen.

        Here is one particularly weird instance in which after one click
        I started getting a NoSuchMethodError each time a new window was
        created!

        EVentually after more clicking the runtime crashed
        % java ThreadTest
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        java.lang.NoSuchMethodError: java.lang.String: method postEvent(Ljava/awt/AWTEvent;)V not found
                at java.lang.Thread.run(Thread.java)
        SIGSEGV 11* segmentation violation
            si_signo [11]: SIGSEGV 11* segmentation violation
            si_errno [0]: Error 0
            si_code [1]: SEGV_ACCERR [addr: 0x4]

                stackbase=6F6C1000, stackpointer=6F6C00D8

        Full thread dump:
            "AWT-Finalizer" (TID:0x6e306b80, sys_thread_t:0x6f620de0, state:CW) prio=9
                java.lang.Object.wait(Object.java)
                sun.awt.AWTFinalizer.run(AWTFinalizer.java:48)
            "Screen Updater" (TID:0x6e306ac0, sys_thread_t:0x6f650de0, state:CW) prio=4
                java.lang.Object.wait(Object.java)
                sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:78)
                sun.awt.ScreenUpdater.run(ScreenUpdater.java:98)
            "AWT-Motif" (TID:0x6e3048f8, sys_thread_t:0x6f6c0de0, state:R) prio=5 *current thread*
                java.lang.Thread.run(Thread.java)
            "AWT-Input" (TID:0x6e304990, sys_thread_t:0x6f6f0de0, state:CW) prio=5
            "AWT-EventQueue-0" (TID:0x6e3049d8, sys_thread_t:0x6f720de0, state:R) prio=5
                java.awt.Component.invalidate(Component.java)
                java.awt.Container.invalidate(Container.java)
                java.awt.Window.dispatchEventImpl(Window.java)
                java.awt.EventDispatchThread.run(EventDispatchThread.java)
            "Thread-5" (TID:0x6e303dd0, sys_thread_t:0x6fa80de0, state:CW) prio=5
                GUIThread.run(ThreadTest.java:37)
            "Thread-4" (TID:0x6e303d90, sys_thread_t:0x6fab0de0, state:CW) prio=5
                GUIThread.run(ThreadTest.java:37)
            "Finalizer thread" (TID:0x6e300220, sys_thread_t:0x6fae0de0, state:CW) prio=1
            "Async Garbage Collector" (TID:0x6e3001d8, sys_thread_t:0x6fb10de0, state:CW) prio=1
            "Idle thread" (TID:0x6e300190, sys_thread_t:0x6fb40de0, state:R) prio=0
            "Clock" (TID:0x6e3000d0, sys_thread_t:0x6fb70de0, state:CW) prio=12
            "main" (TID:0x6e3000a8, sys_thread_t:0x45e88, state:CW) prio=5
        Monitor Cache Dump:
                 sun.awt.motif.MToolkit@6E304B38/6E34F708 (key=0x6e304b38): monitor owner 6f6c0de0: "AWT-Motif"
                Waiting to be notified:
                    "AWT-Input"
                 unknown key (key=0x6fa80de0): unowned
                Waiting to be notified:
                    "Thread-5"
                 unknown key (key=0x6fab0de0): unowned
                Waiting to be notified:
                    "Thread-4"
                 unknown key (key=0x6fb10de0): unowned
                Waiting to be notified:
                    "Async Garbage Collector"
                 sun.awt.AWTFinalizer@6E306B80/6E3572F0 (key=0x6e306b80): unowned
                Waiting to be notified:
                    "AWT-Finalizer"
                 java.lang.Object@6E303890/6E34CB48 (key=0x6e303890): monitor owner 6f720de0: "AWT-EventQueue-0"
                 sun.awt.ScreenUpdater@6E306AC0/6E356E58 (key=0x6e306ac0): unowned
                Waiting to be notified:
                    "Screen Updater"
        Registered Monitor Dump:
            Thread queue lock: unowned
                Waiting to be notified:
                    "main"
            Name and type hash table lock: unowned
            String intern lock: unowned
            JNI global reference lock: unowned
            BinClass lock: unowned
            Class loading lock: unowned
            Java stack lock: unowned
            Code rewrite lock: unowned
            Heap lock: unowned
            Has finalization queue lock: unowned
            Finalize me queue lock: unowned
                Waiting to be notified:
                    "Finalizer thread"
            Monitor IO lock: unowned
            Child death monitor: unowned
            Event monitor: unowned
            I/O monitor: unowned
            Alarm monitor: unowned
                Waiting to be notified:
                    "Clock"
            Sbrk lock: unowned
            Monitor cache expansion lock: unowned
            Monitor registry: monitor owner 6f6c0de0: "AWT-Motif"
        Thread Alarm Q:
            sys_thread_t 0x6fa80de0 [Timeout in 224 ms]
            sys_thread_t 0x6fab0de0 [Timeout in 235 ms]
            sys_thread_t 0x6fb10de0 [Timeout in 364 ms]
        Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Exception in thread "AWT-Motif" Abort (core dumped)


        // Test case: ThreadTest.java
        import java.awt.*;
        public class ThreadTest
        {

                public static void main(String args[])
                {
                        TestFrame f = new TestFrame();
                        GUIThread thread1 = new GUIThread(f, 100, 200);
                        GUIThread thread2 = new GUIThread(f, 200, 100);

                        thread1.start();
                        thread2.start();
                }

        }


        class GUIThread
                extends Thread
        {
                GUIThread(TestFrame f, int x, int y)
                {
                        parentFrame = f;
                        this.x = x;
                        this.y = y;
                }

                public void run()
                {
                        while (true)
                        {
                                try
                                {
                                        parentFrame.pack();
                                        sleep(500);
                                        parentFrame.show();
                                        sleep(500);
                                        parentFrame.resize(x,y);
                                        sleep(500);
                                        parentFrame.hide();
                                }
                                catch (Exception e)
                                {
                                }
                        }
                }


                private TestFrame parentFrame;
                private int x;
                private int y;
        }

        class TestFrame
                extends Frame
        {
                public TestFrame()
                {
                        super();
                       setLayout(new FlowLayout());
                        add(new Button("GUI Thread Test1"));
                        add(new Label("Test Label1"));
                        add(new TextField(10));
                        add(new Button("GUI Thread Test2"));
                        add(new Label("Test Label2"));
                        add(new TextField(10));
                        add(new Button("GUI Thread Test3"));
                        add(new Label("Test Label3"));
                        add(new TextField(10));
                        add(new Button("GUI Thread Test4"));
                        add(new Label("Test Label4"));
                        add(new TextField(10));
                }


                public boolean action(Event e, Object arg)
                {
                        if (e.target instanceof Button)
                        {
                                dispose();
                                return true;
                        }
                        return false;
                }

        }

        This is an update of bug report 4041235 for the Chicago board of trade.
        I have done the following:

        -I have the crash currently stopped in the debugger under a 1.1.1 build.

        - I have expanded out the test case so it is a little more reproducible.

        -I have managed to reproduce in the debugger. See the included stack trace and expanded
         test case.

        -Also if you run with the following options -noclassgc -noasyncgc -ms10m the problem does not seem to happen. More specifically I think
          the problem is related to Garbage collection.

        signal SEGV (no mapping at the fault address) in HandleExposeEvent at line 312 in file "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/../../../../src/solaris/sun/canvas.c"
        (/usr/dist/share/sparcworks,v3.0.1/5.x-sparc/bin/dbx)where
        (/usr/dist/share/sparcworks,v3.0.1/5.x-sparc/bin/dbx)where
        (/usr/dist/share/sparcworks,v3.0.1/5.x-sparc/bin/dbx) syntax error
        (/usr/dist/share/sparcworks,v3.0.1/5.x-sparc/bin/dbx) where
        =>[1] HandleExposeEvent(w = 0x1221a8, javaObject = 0xee305980, event = 0xeddb0138), line 312 in "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/../../../../src/solaris/sun/canvas.c"
          [2] awt_canvas_handleEvent(w = 0x1221a8, client_data = 0xee305980 "", event = 0xeddb0138, winfo = (nil), cont = 0xeddaffaf "", passEvent = '\0'), line 858 in "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/../../../../src/solaris/sun/canvas.c"
          [3] awt_canvas_event_handler(w = 0x1221a8, client_data = 0xee305980 "", event = 0xeddb0138, cont = 0xeddaffaf ""), line 1069 in "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/../../../../src/solaris/sun/canvas.c"
          [4] DispatchEvent(0xeddb0138, 0x1221a8, 0x8000, 0x0, 0x0, 0xffffffff), at 0xeddd5b7c
          [5] DecideToDispatch(0xeddb0138, 0x8f0a4, 0x8000, 0x0, 0x1221a8, 0x0), at 0xeddd6224
          [6] XtDispatchEvent(0xeddb0138, 0x0, 0x64748, 0x0, 0x1, 0x8bfe8), at 0xeddd6408
          [7] XtAppProcessEvent(0x8bfe8, 0x0, 0x8c1b4, 0x8bff4, 0x8c1b0, 0x1), at 0xeddded1c
          [8] awt_MToolkit_loop(isModal = 0), line 741 in "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/../../../../src/solaris/sun/awt_MToolkit.c"
          [9] sun_awt_motif_MToolkit_run(this = 0xee304330), line 766 in "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/../../../../src/solaris/sun/awt_MToolkit.c"
          [10] Java_sun_awt_motif_MToolkit_run_stub(_P_ = 0xb2b88, _EE_ = 0xeddb0ca4), line 354 in "/dat/javasoft/jdk1.1.1ws/build/solaris/sun/awt/libstubs.c"
          [11] invokeNativeMethod(o = 0xee304330, mb = 0xa4b70, args_size = 1, ee = 0xeddb0ca4), line 224 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/share/java/runtime/classruntime.c"
          [12] invokeLazyNativeMethod(o = 0xee304330, mb = 0xa4b70, args_size = 1, ee = 0xeddb0ca4), line 525 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/share/java/runtime/classruntime.c"
          [13] ExecuteJava(initial_pc = 0xeddb0b84 "Ù^M^AM-^XM-^X", ee = 0xeddb0ca4), line 1685 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/share/java/runtime/executeJava.c"
          [14] do_execute_java_method_vararg(ee = 0xeddb0ca4, obj = 0xee3043e8, method_name = 0xef76a394 "run", method_signature = 0xef76a398 "()V", mb = (nil), isStaticCall = FALSE, args = 0xeddb0c84, otherBits = (nil), shortFloats = FALSE), line 587 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/share/java/runtime/interpreter.c"
          [15] execute_java_dynamic_method(ee = 0xeddb0ca4, obj = 0xee3043e8, method_name = 0xef76a394 "run", signature = 0xef76a398 "()V", ...), line 269 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/share/java/runtime/interpreter.c"
          [16] ThreadRT0(p = 0xee3043e8), line 61 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/share/java/lang/thread.c"
          [17] start_func(dummy = 1, arg = -298826776, func = &`thread.c`ThreadRT0(Hjava_lang_Thread *p) at 0xef7097c8), line 222 in "/dat/javasoft/jdk1.1.1ws/build/solaris/java/java/../../../../src/solaris/java/green_threads/src/threads_md.c"
        (/usr/dist/share/sparcworks,v3.0.1/5.x-sparc/bin/dbx)



        // Test case: ThreadTest.java
        // This program crashes in 1.1.1 on Solaris.
        // You will need to click on the appearing and windows to make it happen.
        // If you have any problems reproducing it please let me know..
        // Tom Kincaid kincaid@east x23230.

        import java.awt.*;
        public class ThreadTest
        {

                public static void main(String args[])
                {
                        TestFrame f = new TestFrame();
                        GUIThread thread1 = new GUIThread(f, 100, 200);
                        

              tbell Tim Bell
              prr Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: