Modify

Opened 6 years ago

Closed 6 years ago

#850 closed Bug (fixed)

Deadlock between Java-threads

Reported by: centic Owned by: bflorat
Priority: 5, normal Milestone: 1.4.6
Component: Core Version: 1.4.4
Keywords: Cc:
Regression ?:

Description

I had a case where the Java VM detected a deadlock between multiple threads, it seems there are cases where multiple threads can lock out each other:

 Found one Java-level deadlock:
 =============================
 "Thread-88":
  waiting to lock monitor 0x02c9f474 (object 0x09583348, a org.jajuk.base.ObserverRegistry),
  which is held by "Thread-80"
 "Thread-80":
  waiting to lock monitor 0x02c9f2d4 (object 0x093e4b58, a java.awt.Component$AWTTreeLock),
  which is held by "AWT-EventQueue-1"
 "AWT-EventQueue-1":
  waiting to lock monitor 0x02c9f4dc (object 0x0ab3c0b0, a org.jajuk.ui.views.StatView),
  which is held by "Thread-80"

 Java stack information for the threads listed above:
 ===================================================
 "Thread-88":
        at org.jajuk.base.ObserverRegistry.notifySync(ObserverRegistry.java:37)
        - waiting to lock <0x09583348> (a org.jajuk.base.ObserverRegistry)
        at org.jajuk.base.ObservationManager.notifySync(ObservationManager.java:122)
        at org.jajuk.base.ObservationManager$1$1.run(ObservationManager.java:64)
 "Thread-80":
        at java.awt.Component.setFont(Component.java:1632)
        - waiting to lock <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.setFont(Container.java:1571)
        at javax.swing.JComponent.setFont(JComponent.java:2721)
        at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:190)
        at javax.swing.plaf.basic.BasicPanelUI.installDefaults(BasicPanelUI.java:49)
        at org.jvnet.substance.SubstancePanelUI.__org__jvnet__substance__SubstancePanelUI__installDefaults(SubstancePanelUI.java)
        at org.jvnet.substance.SubstancePanelUI.installDefaults(SubstancePanelUI.java)
        at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:39)
        at org.jvnet.substance.SubstancePanelUI.__org__jvnet__substance__SubstancePanelUI__installUI(SubstancePanelUI.java)
        at org.jvnet.substance.SubstancePanelUI.installUI(SubstancePanelUI.java)
        at javax.swing.JComponent.setUI(JComponent.java:673)
        at javax.swing.JPanel.setUI(JPanel.java:136)
        at javax.swing.JPanel.updateUI(JPanel.java:109)
        at javax.swing.JPanel.<init>(JPanel.java:69)
        at javax.swing.JPanel.<init>(JPanel.java:92)
        at javax.swing.JPanel.<init>(JPanel.java:100)
        at org.jfree.chart.ChartPanel.<init>(ChartPanel.java:541)
        at org.jfree.chart.ChartPanel.<init>(ChartPanel.java:422)
        at org.jajuk.ui.views.StatView.createDeviceRepartition(StatView.java:216)
        at org.jajuk.ui.views.StatView.update(StatView.java:385)
        - locked <0x0ab3c0b0> (a org.jajuk.ui.views.StatView)
        at org.jajuk.base.ObserverRegistry.notifySync(ObserverRegistry.java:51)
        - locked <0x09583348> (a org.jajuk.base.ObserverRegistry)
        at org.jajuk.base.ObservationManager.notifySync(ObservationManager.java:122)
        at org.jajuk.base.ObservationManager$1$1.run(ObservationManager.java:64)
 "AWT-EventQueue-1":
        at org.jvnet.substance.SubstanceFillBackgroundDelegate.update(SubstanceFillBackgroundDelegate.java:144)
        - waiting to lock <0x0ab3c0b0> (a org.jajuk.ui.views.StatView)
        at org.jvnet.substance.SubstanceFillBackgroundDelegate.update(SubstanceFillBackgroundDelegate.java:87)
        at org.jvnet.substance.SubstancePanelUI.__org__jvnet__substance__SubstancePanelUI__update(SubstancePanelUI.java:85)
        at org.jvnet.substance.SubstancePanelUI.__org__jvnet__substance__SubstancePanelUI__container__update(SubstancePanelUI.java)
        at org.jvnet.substance.SubstancePanelUI.update(SubstancePanelUI.java)
        at javax.swing.JComponent.paintComponent(JComponent.java:763)
        at org.jdesktop.swingx.JXPanel.access$001(JXPanel.java:52)
        at org.jdesktop.swingx.JXPanel$1.doPaint(JXPanel.java:116)
        at org.jdesktop.swingx.JXPanel$1.doPaint(JXPanel.java:115)
        at org.jdesktop.swingx.painter.AbstractPainter.paint(AbstractPainter.java:392)
        at org.jdesktop.swingx.JXPanel.paintComponent(JXPanel.java:324)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at org.jdesktop.swingx.JXPanel.paint(JXPanel.java:310)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        - locked <0x093e4b58> (a java.awt.Component$AWTTreeLock)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at ext.EventDispatchThreadHangMonitor.dispatchEvent(EventDispatchThreadHangMonitor.java:144)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by bflorat

  • Milestone changed from To Be Decided by Jajuk Team to 1.4.6

Thanks. I'm not sure to fully understand the dead lock but it was obvious that the StatView? was over-sychronized. I suspect the dead lock in the update() method that itself requires a lock on StyleManager? to refresh styles. I removed all monitors from the StatView? class.

comment:2 Changed 6 years ago by centic

Thread-88 is waiting on Thread-80,
Thread-80 is waiting on Thread AWT-EventQueue?
Thread AWT-EventQueue? is waiting on Thread-80

this causes the deadlocked. All threads are waiting on other threads.

The StatView? lock is part of the deadlock, so removing it should avoid this problem.

comment:3 Changed 6 years ago by bflorat

  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.