Harmony
  1. Harmony
  2. HARMONY-5261

[classlib][swing] JTextArea deadlocks on ArgoUML startup

    Details

      Description

      ArgoUML hangs on startup in client and JET modes of DRLVM. It displays ~25% on progress bar at splash screen and hangs. But it does not usually hang on interpreter, opt and server mode.
      Unfortunately J9 VME crashes much earlier, so no reference result is available.

      Remote debugging helped to prove this is a deadlock in classlib UI:
      1) In AWT-EventDispatchThread: JTextArea.setText() forwards to AbstractDocument.replace(), which captures writeLock, then calls fireRemoveUpdate() which finally contends to lockAWT();
      2) In the Main thread: lockAWT() before adding a component to container, then calls through chain JComponent.getPreferredSize() -> JTextArea.getPreferredSize() -> AbstractDocument.readLock().
      So the 1st thread holds document's lock and waits for AWT lock, while 2nd thread holds AWT lock and waits for document's lock.

      Below are complete traces:

      Thread [AWT-EventDispatchThread] (Suspended)
      VMThreadManager.wait(Object, long, int) line: not available [native method]
      Object.wait() line: 94 [local variables unavailable]
      Synchronizer.park(Thread) line: 197
      Synchronizer.lock() line: 95
      ToolkitImpl(Toolkit).lockAWT() line: 392 [local variables unavailable]
      JTextArea(Component).getSize() line: 1359
      TextUtils.getEditorRect(JComponent) line: 1010
      BasicTextAreaUI(BasicTextUI).getVisibleEditorRect() line: 537
      BasicTextUI$Listener.removeUpdate(DocumentEvent) line: 263
      PlainDocument(AbstractDocument).fireRemoveUpdate(DocumentEvent) line: 1276
      PlainDocument(AbstractDocument).doRemove(int, int) line: 1413
      PlainDocument(AbstractDocument).doReplace(int, int, String, AttributeSet) line: 1424
      PlainDocument(AbstractDocument).replace(int, int, String, AttributeSet) line: 1213
      JTextArea(JTextComponent).setText(String) line: 1556
      WizDescription.setTarget(Object) line: 86
      TabToDo.setTargetInternal(Object) line: 164
      TabToDo.componentShown(ComponentEvent) line: 241
      TabToDo(Component).processComponentEventImpl(ComponentEvent, Collection) line: 3814
      TabToDo(Component).processComponentEvent(ComponentEvent) line: 3798
      TabToDo(Component).processEvent(AWTEvent) line: 3652
      TabToDo(Container).processEvent(AWTEvent) line: 1293
      TabToDo(Component).dispatchEvent(AWTEvent) line: 3568
      EventQueueCore.dispatchEventImpl(AWTEvent) line: 149
      EventQueue.dispatchEvent(AWTEvent) line: 144
      EventDispatchThread.runModalLoop(ModalContext) line: 74
      EventDispatchThread.run() line: 48

      Thread [main] (Suspended)
      VMThreadManager.wait(Object, long, int) line: not available [native method]
      Object.wait() line: 94 [local variables unavailable]
      AbstractDocument$ReadWriteLock.readLock() line: 857
      PlainDocument(AbstractDocument).readLock() line: 1160
      RootView.readLock() line: 295
      RootView.getPreferredSpan(int) line: 166
      BasicTextAreaUI(BasicTextUI).getPreferredSize(JComponent) line: 509
      BasicTextAreaUI.getPreferredSize(JComponent) line: 108
      JTextArea(JComponent).getPreferredSize() line: 468
      JTextArea.getPreferredSize() line: 242
      JTextArea.getPreferredScrollableViewportSize() line: 233
      ViewportLayout.preferredLayoutSize(Container) line: 87
      JViewport(JComponent).getPreferredSize() line: 474
      ScrollPaneLayout.preferredLayoutSize(Container) line: 187
      JScrollPane(JComponent).getPreferredSize() line: 474
      BorderLayout.validateArrays(Container) line: 436
      BorderLayout.validate(Container) line: 394
      BorderLayout.minimumLayoutSize(Container) line: 274
      JPanel(JComponent).getMinimumSize() line: 439
      BorderLayout.validateArrays(Container) line: 435
      BorderLayout.validate(Container) line: 394
      BorderLayout.preferredLayoutSize(Container) line: 291
      WizDescription(JComponent).getPreferredSize() line: 474
      SplitterLayout.addLayoutComponent(String, Component) line: not available
      SplitterLayout(ProportionalLayout).addLayoutComponent(Component, Object) line: not available
      MultipleSplitPane(Container).addToLayout(Component, Object) line: 390
      MultipleSplitPane(Container).addImpl(Component, Object, int) line: 424
      MultipleSplitPane(Container).add(Component, Object, int) line: 236
      MultipleSplitPane.add(Component, Object, int) line: not available
      BorderSplitPane.add(Component) line: not available
      BorderSplitPane.add(Component, Object) line: not available
      TabToDo.showDescription() line: 115
      TabToDo.setTargetInternal(Object) line: 172
      TabToDo.setTarget(Object) line: 158
      DetailsPane.setTarget(Object) line: 297
      DetailsPane.<init>(String, Orientation) line: 185
      ProjectBrowser.makeDetailsPane(String, Orientation) line: 938
      ProjectBrowser.createDetailsPanes() line: 447
      ProjectBrowser.createPanels(SplashScreen) line: 401
      ProjectBrowser.<init>(String, SplashScreen, boolean) line: 261
      ProjectBrowser.makeInstance(SplashScreen, boolean) line: 354
      ProjectBrowser.makeInstance(SplashScreen) line: 336
      Main.initializeGUI(SplashScreen) line: 684
      Main.main(String[]) line: 262
      VMReflection.invokeMethod(long, Object, Object[]) line: not available [native method]
      Method.invoke(Object, Object[]) line: 317
      JarRunner.main(String[]) line: 89

      To reproduce:
      1) Launch debuggee app:
      > java -agentlib:jdwp=server=y,transport=dt_socket,suspend=y -jar argouml.jar
      INFO: [TransportManager.cpp:204] transport is listening on 49077
      2) In Eclipse UI, Debug > Remote Java App> (specify the port ) ->Debug, then switch to Debug perspective and enjoy

      As this is a race condition, it may take few attempts to capture the deadlock.

      1. c.log
        11 kB
        Alexey Varlamov
      2. b.log
        13 kB
        Alexey Varlamov
      3. a.log
        12 kB
        Alexey Varlamov

        Activity

        Hide
        Alexey Varlamov added a comment -

        OK, I evaluated the picture with remote debugger and updated the issue accordingly. Hope this time UI people will address the issue.

        Show
        Alexey Varlamov added a comment - OK, I evaluated the picture with remote debugger and updated the issue accordingly. Hope this time UI people will address the issue.
        Hide
        Mikhail Fursov added a comment -

        It does not run on OPT either:

        EM: compile done:[CS_OPT n=11042: OK] java/lang/StackTraceElement.toString()Ljava/lang/String;
        EM: compile start:[CS_OPT n=11044] java/lang/Throwable.getCause()Ljava/lang/Throwable;
        EM: compile done:[CS_OPT n=11044: OK] java/lang/Throwable.getCause()Ljava/lang/Throwable;
        java.lang.NullPointerException
        at java.awt.BorderLayout.constraints2Index(BorderLayout.java:446)
        at java.awt.BorderLayout.validateArrays(BorderLayout.java:428)
        at java.awt.BorderLayout.validate(BorderLayout.java:394)
        at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:274)
        at javax.swing.JComponent.getMinimumSize(JComponent.java)
        at java.awt.BorderLayout.validateArrays(BorderLayout.java)
        at java.awt.BorderLayout.validate(BorderLayout.java:394)
        at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:274)
        at javax.swing.JComponent.getMinimumSize(JComponent.java)
        at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateContentAreaSize(BasicTabbedPaneUI.java)
        at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(BasicTabbedPaneUI.java:165)
        at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.minimumLayoutSize(BasicTabbedPaneUI.java)
        at javax.swing.JComponent.getMinimumSize(JComponent.java)
        at java.awt.BorderLayout.validateArrays(BorderLayout.java)
        at java.awt.BorderLayout.validate(BorderLayout.java:394)
        at java.awt.BorderLayout.layoutContainer(BorderLayout.java:303)
        at java.awt.Container.layout(Container.java)
        at java.awt.Container.doLayout(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Container.validateTree(Container.java)
        at java.awt.Container.validate(Container.java)
        at java.awt.Component.show(Component.java)
        at java.awt.Window.show(Window.java:547)
        at java.awt.Component.show(Component.java)
        at java.awt.Component.setVisible(Component.java:3095)
        at org.argouml.ui.ProjectBrowser.setVisible(ProjectBrowser.java:871)
        at org.argouml.application.Main.main(Main.java)

        Show
        Mikhail Fursov added a comment - It does not run on OPT either: EM: compile done: [CS_OPT n=11042: OK] java/lang/StackTraceElement.toString()Ljava/lang/String; EM: compile start: [CS_OPT n=11044] java/lang/Throwable.getCause()Ljava/lang/Throwable; EM: compile done: [CS_OPT n=11044: OK] java/lang/Throwable.getCause()Ljava/lang/Throwable; java.lang.NullPointerException at java.awt.BorderLayout.constraints2Index(BorderLayout.java:446) at java.awt.BorderLayout.validateArrays(BorderLayout.java:428) at java.awt.BorderLayout.validate(BorderLayout.java:394) at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:274) at javax.swing.JComponent.getMinimumSize(JComponent.java) at java.awt.BorderLayout.validateArrays(BorderLayout.java) at java.awt.BorderLayout.validate(BorderLayout.java:394) at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:274) at javax.swing.JComponent.getMinimumSize(JComponent.java) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateContentAreaSize(BasicTabbedPaneUI.java) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSize(BasicTabbedPaneUI.java:165) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.minimumLayoutSize(BasicTabbedPaneUI.java) at javax.swing.JComponent.getMinimumSize(JComponent.java) at java.awt.BorderLayout.validateArrays(BorderLayout.java) at java.awt.BorderLayout.validate(BorderLayout.java:394) at java.awt.BorderLayout.layoutContainer(BorderLayout.java:303) at java.awt.Container.layout(Container.java) at java.awt.Container.doLayout(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Container.validateTree(Container.java) at java.awt.Container.validate(Container.java) at java.awt.Component.show(Component.java) at java.awt.Window.show(Window.java:547) at java.awt.Component.show(Component.java) at java.awt.Component.setVisible(Component.java:3095) at org.argouml.ui.ProjectBrowser.setVisible(ProjectBrowser.java:871) at org.argouml.application.Main.main(Main.java)
        Hide
        Mikhail Fursov added a comment -

        I found that when running ArgoUML in -Xem:opt mode we have an assertion in escape analysis pass.

        msvcr71d.dll!_assert(const char * expr=0x024fdef8, const char * filename=0x024fdea8, unsigned int lineno=1594) Line 295 C
        > jitrino.dll!Jitrino::EscAnalyzer::scanCnGNodeRefsGE(Jitrino::EscAnalyzer::CnGNode * cgn=0x059f05c8, bool check_var_src=false) Line 1594 + 0x1f C++
        jitrino.dll!Jitrino::EscAnalyzer::setCreatedObjectStates() Line 1334 C++
        jitrino.dll!Jitrino::EscAnalyzer::doAnalysis() Line 240 C++
        jitrino.dll!Jitrino::EscapeAnalysisPass::_run(Jitrino::IRManager & irm=

        {...}

        ) Line 89 C++
        jitrino.dll!Jitrino::OptPass::run() Line 62 + 0x11 C++

        Show
        Mikhail Fursov added a comment - I found that when running ArgoUML in -Xem:opt mode we have an assertion in escape analysis pass. msvcr71d.dll!_assert(const char * expr=0x024fdef8, const char * filename=0x024fdea8, unsigned int lineno=1594) Line 295 C > jitrino.dll!Jitrino::EscAnalyzer::scanCnGNodeRefsGE(Jitrino::EscAnalyzer::CnGNode * cgn=0x059f05c8, bool check_var_src=false) Line 1594 + 0x1f C++ jitrino.dll!Jitrino::EscAnalyzer::setCreatedObjectStates() Line 1334 C++ jitrino.dll!Jitrino::EscAnalyzer::doAnalysis() Line 240 C++ jitrino.dll!Jitrino::EscapeAnalysisPass::_run(Jitrino::IRManager & irm= {...} ) Line 89 C++ jitrino.dll!Jitrino::OptPass::run() Line 62 + 0x11 C++
        Hide
        Vladimir Beliaev added a comment -

        Ok, I agree. Let it be then [drlvm][jit][jet] w/o "Classlib" in "Components" list. Mikhail, could you update the JIRA please?

        Show
        Vladimir Beliaev added a comment - Ok, I agree. Let it be then [drlvm] [jit] [jet] w/o "Classlib" in "Components" list. Mikhail, could you update the JIRA please?
        Hide
        Mikhail Markov added a comment -

        As ArgoUML hangs only on specific JIT modes (i.e. JET & client) i think the component should be [drlvm][jit][jet].

        Show
        Mikhail Markov added a comment - As ArgoUML hangs only on specific JIT modes (i.e. JET & client) i think the component should be [drlvm] [jit] [jet] .
        Hide
        Vladimir Beliaev added a comment -

        I mean, could someone remove DRLVM from Components list? We'll return it back when one is sure the issue is in drlvm, not classlib.

        Show
        Vladimir Beliaev added a comment - I mean, could someone remove DRLVM from Components list? We'll return it back when one is sure the issue is in drlvm, not classlib.
        Hide
        Vladimir Beliaev added a comment -

        I'm confused by JIRA summary which is [classlib] although component is DRLVM.

        I undertsand the point - the issue may be anywhere - classlib/awt, drlvm/jet, etc. Still I would just do the best quess here which issue it is and then ask related people to take a look...

        I mean you pick AWT guys to get the stick - ok, let's have this JIRA be against Classlib component then...

        Show
        Vladimir Beliaev added a comment - I'm confused by JIRA summary which is [classlib] although component is DRLVM. I undertsand the point - the issue may be anywhere - classlib/awt, drlvm/jet, etc. Still I would just do the best quess here which issue it is and then ask related people to take a look... I mean you pick AWT guys to get the stick - ok, let's have this JIRA be against Classlib component then...
        Hide
        Alexey Varlamov added a comment -

        The deadlock is intermittent. Here are 3 java thread dumps for different launch attempts, they are almost identical.

        I suggest our AWT gurus take a look at this.

        Show
        Alexey Varlamov added a comment - The deadlock is intermittent. Here are 3 java thread dumps for different launch attempts, they are almost identical. I suggest our AWT gurus take a look at this.
        Hide
        Alexey Varlamov added a comment -

        I not sure there is JIT specifics actually, the difference might be in race condition due to compilation speed.

        Show
        Alexey Varlamov added a comment - I not sure there is JIT specifics actually, the difference might be in race condition due to compilation speed.

          People

          • Assignee:
            Unassigned
            Reporter:
            Alexey Varlamov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development