Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-5261

[classlib][swing] JTextArea deadlocks on ArgoUML startup

    XMLWordPrintableJSON

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.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            varlax Alexey Varlamov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: