JDK-4992757 : Java program working JDK 1.3.1_10 appears to hang with JDK 1.4.2_03
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2_03
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2004-02-11
  • Updated: 2005-07-11
  • Resolved: 2004-03-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.
Other
5.0 b43Fixed
Related Reports
Relates :  
Description
A customer developing their software has reported that their application appears to hang in XinitThreads call on system running JDK 1.4.2_03. This looks very similar to one of the issues described in bug 4908942 and initial investigation seems to suggest that the application hangs in C++ JNI call to XInitThreads(). The program does not exhibit this behaviour with the same system running Solaris 9 plus patches running Java 1.3.1_10.

The problem has been reliably reproduced here on systems running:

  * Solaris 9 (latest patches)
  * java 1.4.2_02
  * C++ 5.5 (latest patches)

The customer explained:

Apparently AWT and swing internally do not call XInitThreads(). If
XInitThreads() is called, AWT or swing contain code that causes a hang.

This is occurring with our customers who try to load our app (MainWin) into a Java based application, and also use AWT/swing


short description of the problem:
This is the stack when java hangs:
  [6] _XLockDisplay
  [7] XFindContext
  [8] _XmGetWidgetExtData
  [9] _XmGetFocusData
  [10] XmGetFocusWidget
  [11] 0xfbdb6a0c
  [12] XCheckIfEvent

java calls XCheckIfEvent, and supplies a callback function. This
callback function causes the call to XFindContext. When our app loads, it calls
XInitThreads (enables X locks, for safe multithreaded execution). As a
result of the X locks initialization, XCheckIfEvent locks the display.
XFindContext fails to lock the already locked display, and hangs.

The customer is using the XInitThreads as described in manpage


The full trace is shown in comments section:

Full thread dump Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode):

"SIGTERM handler" daemon prio=10 tid=0x0024f540 nid=0x3e waiting for monitor entry [ee5ff000..ee5ffc30]
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - waiting to lock <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)

"SIGINT handler" daemon prio=10 tid=0x0024e950 nid=0x3d waiting for monitor entry [ee6ff000..ee6ffc30]
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - waiting to lock <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)

"SIGINT handler" daemon prio=10 tid=0x0024dd60 nid=0x3c waiting for monitor entry [ee7ff000..ee7ffc30]
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - waiting to lock <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)

"SIGINT handler" daemon prio=10 tid=0x0024d170 nid=0x3b waiting for monitor entry [ee8ff000..ee8ffc30]
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - waiting to lock <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)

"SIGINT handler" daemon prio=10 tid=0x0024c580 nid=0x3a waiting for monitor entry [ee9ff000..ee9ffc30]
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - waiting to lock <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)
......

"SIGINT handler" daemon prio=10 tid=0x001544d8 nid=0x17 waiting for monitor entry [f0cff000..f0cffc30]
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - waiting to lock <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)

"Shutdown-Thread" prio=5 tid=0x00154048 nid=0x16 waiting for monitor entry [f0dff000..f0dffc30]
        at sun.awt.motif.MToolkit.shutdown(Native Method)
        at sun.awt.motif.MToolkit.access$000(MToolkit.java:50)
        at sun.awt.motif.MToolkit$2.run(MToolkit.java:130)
        at java.lang.Thread.run(Thread.java:534)

"SIGINT handler" daemon prio=10 tid=0x000e72f0 nid=0x15 in Object.wait() [f0eff000..f0effc30]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1f18ea8> (a java.lang.Thread)
        at java.lang.Thread.join(Thread.java:1001)
        - locked <0xf1f18ea8> (a java.lang.Thread)
        at java.lang.Thread.join(Thread.java:1054)
        at java.lang.Shutdown.runHooks(Shutdown.java:130)
        at java.lang.Shutdown.sequence(Shutdown.java:165)
        at java.lang.Shutdown.exit(Shutdown.java:210)
        - locked <0xf59a4d40> (a java.lang.Class)
        at java.lang.Terminator$1.handle(Terminator.java:35)
        at sun.misc.Signal$1.run(Signal.java:195)
        at java.lang.Thread.run(Thread.java:534)

"TimerQueue" daemon prio=5 tid=0x000e8120 nid=0x10 in Object.wait() [f0fff000..f0fffc30]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1802988> (a javax.swing.TimerQueue)
        at javax.swing.TimerQueue.run(TimerQueue.java:231)
        - locked <0xf1802988> (a javax.swing.TimerQueue)
        at java.lang.Thread.run(Thread.java:534)

"AWT-EventQueue-0" prio=6 tid=0x0011b680 nid=0xd waiting for monitor entry [f10fe000..f10ffc30]
        at sun.awt.motif.MComponentPeer.pSetCursor(Native Method)
        at sun.awt.motif.MGlobalCursorManager.setCursor(MGlobalCursorManager.java:60)
        at sun.awt.GlobalCursorManager._updateCursor(GlobalCursorManager.java:192)
        at sun.awt.GlobalCursorManager.updateCursorImmediately(GlobalCursorManager.java:82)
        at sun.awt.motif.MComponentPeer.updateCursorImmediately(MComponentPeer.java:249)
        at java.awt.Component.updateCursorImmediately(Component.java:2250)
        at java.awt.Component.hide(Component.java:1175)
        - locked <0xf1a11648> (a java.awt.Component$AWTTreeLock)
        at java.awt.Window.hide(Window.java:514)
        at java.awt.Dialog.hide(Dialog.java:625)
        at java.awt.Component.show(Component.java:1136)
        at java.awt.Component.setVisible(Component.java:1088)
        at javax.swing.JFileChooser.approveSelection(JFileChooser.java:1586)
        at javax.swing.plaf.basic.BasicFileChooserUI$DoubleClickListener.mouseClicked(BasicFileChooserUI.java:412)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
        at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:211)
        at java.awt.Component.processMouseEvent(Component.java:5103)
        at java.awt.Component.processEvent(Component.java:4897)
        at java.awt.Container.processEvent(Container.java:1569)
        at java.awt.Component.dispatchEventImpl(Component.java:3615)
        at java.awt.Container.dispatchEventImpl(Container.java:1627)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3207)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
        at java.awt.Container.dispatchEventImpl(Container.java:1613)
        at java.awt.Window.dispatchEventImpl(Window.java:1606)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
        at java.awt.Dialog$1.run(Dialog.java:540)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

"AWT-Shutdown" prio=5 tid=0x00159eb8 nid=0xc in Object.wait() [f13ff000..f13ffc30]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1a11430> (a java.lang.Object)
        at java.lang.Object.wait(Object.java:429)
        at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
        - locked <0xf1a11430> (a java.lang.Object)
        at java.lang.Thread.run(Thread.java:534)

"Java2D Disposer" daemon prio=10 tid=0x00108428 nid=0xb in Object.wait() [f11ff000..f11ffc30]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1a114a0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
        - locked <0xf1a114a0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
        at sun.java2d.Disposer.run(Disposer.java:100)
        at java.lang.Thread.run(Thread.java:534)

"AWT-Motif" daemon prio=6 tid=0x0019e4e8 nid=0xa runnable [f12ff000..f12ffc30]
        at sun.awt.motif.MToolkit.run(Native Method)
        at java.lang.Thread.run(Thread.java:534)

"Signal Dispatcher" daemon prio=10 tid=0x000c4420 nid=0x6 waiting on condition [0..fbf7fc70]

"Finalizer" daemon prio=8 tid=0x000bde30 nid=0x4 in Object.wait() [fc77f000..fc77fc30]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1a115e0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
        - locked <0xf1a115e0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x000bd3b0 nid=0x3 in Object.wait() [fe27f000..fe27fc30]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1a10758> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:429)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
        - locked <0xf1a10758> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=0x0002cd58 nid=0x1 in Object.wait() [ffbfe000..ffbff1e4]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xf1a11648> (a java.awt.Component$AWTTreeLock)
        at java.lang.Object.wait(Object.java:429)
        at java.awt.Dialog.show(Dialog.java:570)
        - locked <0xf1a11648> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JFileChooser.showDialog(JFileChooser.java:696)
        at javax.swing.JFileChooser.showOpenDialog(JFileChooser.java:599)
        at MWSystemLoadIssue.main(MWSystemLoadIssue.java:32)

"VM Thread" prio=5 tid=0x000bc558 nid=0x2 runnable 

"VM Periodic Task Thread" prio=10 tid=0x000c7280 nid=0x8 waiting on condition 
"Suspend Checker Thread" prio=10 tid=0x000c3ab8 nid=0x5 runnable



At this point the program has to be killed with -9. The reprocuble case is attached to this report.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b43 tiger-beta2
24-08-2004

EVALUATION Name: rpR10076 Date: 02/13/2004 This bug is related to 4908942. Though having slightly different visible effects, they are caused by the same problems. Unfortunately, the problems are two: one is in J2SE code, and another is in X11 code. So, to resolve this issue completely, we will need not only the changes to J2Se code, but we will need xserver bug 4985837 escalated and fixed for Solaris 8 and Solaris 9. ###@###.### ======================================================================
24-08-2004

WORK AROUND None found
24-08-2004

PUBLIC COMMENTS Java Program hangs with 1.4.2_03 and works properly with JDK 1.3.1_10. Initial investigation seems to relate to one of the issues reported in 4908942.
24-08-2004