[
https://issues.apache.org/jira/browse/NETBEANS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16416841#comment-16416841
]
Tim Boudreau commented on NETBEANS-373:
---------------------------------------
It's not "we" per-se - it's the AWT tree lock - a global lock baked into the
bones of AWT and Swing, and the root cause of almost all the deadlocks I fixed
over 11 years of working on it. In short, it is _never_ __ safe to do
_anything_ to AWT or Swing components on any thread other the event thread
(even if it looks like it works, a different Swing look and feel may call
different methods or the same methods in a different order, and far too many
component methods will take the tree lock - exactly the problem here).
The bug is really in the JDK. Here we just need to find an effective
workaround. In this case, replanning the listener add to the event thread will
do the job - we just need to verify what the actual code path and target
component that's triggering the deadlock _is._
Most likely it is the accessible component created by the dialog, simply
because there is a decent chance of another thread getting hold of the dialog
thanks to the native peer being assigned when pack() is called.
> Netbeans sometimes freezes when showing any refactor dialog when running with
> jdk 1.8.0_152-b16 or later
> --------------------------------------------------------------------------------------------------------
>
> Key: NETBEANS-373
> URL: https://issues.apache.org/jira/browse/NETBEANS-373
> Project: NetBeans
> Issue Type: Bug
> Components: java - Refactoring
> Affects Versions: 8.2, 9.0
> Environment: Mac
> Reporter: Austin Stephens
> Priority: Blocker
> Attachments: nbpresenter.diff
>
>
> Sometimes (or almost always), when you try to do some refactor action,
> NetBeans freezes. It appears that a lock is obtained on a panel when the
> dialog is shown, and the AppKit Thread tries to get the lock while trying to
> add an accessible listener to it.
> AppKit Thread:
> {code:java}
> Container.addContainerListener:2142
> Container$AccessibleAWTContainer.addPropertyChangeListener:3885
> JComponent$AccessibleJComponent.addPropertyChangeListener:3765
> Hidden Source Calls
> CAccessible.addNotificationListeners:102
> CAccessible.<init>:84
> CAccessible.getCAccessible:60
> {code}
> EDT Thread:
> {code:java}
> Hidden Source Calls
> Unsafe.park
> LockSupport.park:194
> AbstractQueuedSynchronizer$ConditionObject.await:2062
> EventQueue.getNextEvent:557
> EventDispatchThread.pumpOneEventForFilters:173
> EventDispatchThread.pumpEventsForFilter:124
> EventDispatchThread.pumpEventsForFilter:117
> WaitDispatchSupport$2.run:190
> WaitDispatchSupport$4.run:235
> WaitDispatchSupport$4.run:233
> AccessController.doPrivileged
> WaitDispatchSupport.enter:233
> Dialog.show:1070
> NbPresenter.superShow:1060
> NbPresenter.doShow:1110
> NbPresenter.run:1082
> NbPresenter.run:105
> NbMutexEventProvider$Event.doEventAccess:115
> NbMutexEventProvider$Event.readAccess:75
> LazyMutexImplementation.readAccess:71
> Mutex.readAccess:193
> NbPresenter.show:1067
> Component.show:1669
> Component.setVisible:1616
> Window.setVisible:1017
> Dialog.setVisible:1005
> ParametersPanel.showDialog:674
> RefactoringPanel.refresh:660
> RefactoringPanel.<init>:144
> UI.openRefactoringUI:61
> ContextAnalyzer$4.show:648
> ContextAnalyzer$TextComponentTask.run:369
> RefactoringActionsProvider.doFindUsages:232
> ActionsImplementationFactory.doFindUsages:91
> WhereUsedAction.performAction:52
> RefactoringGlobalAction$ContextAction.actionPerformed:172
> TopComponent.processKeyBinding:1151
> JComponent.processKeyBindings:2963
> JComponent.processKeyEvent:2863
> Component.processEvent:6355
> Container.processEvent:2259
> Component.dispatchEventImpl:4961
> Container.dispatchEventImpl:2317
> Component.dispatchEvent:4793
> KeyboardFocusManager.redispatchEvent:1955
> DefaultKeyboardFocusManager.dispatchKeyEvent:827
> DefaultKeyboardFocusManager.preDispatchKeyEvent:1096
> DefaultKeyboardFocusManager.typeAheadAssertions:966
> DefaultKeyboardFocusManager.dispatchEvent:792
> Component.dispatchEventImpl:4842
> Container.dispatchEventImpl:2317
> Window.dispatchEventImpl:2758
> Component.dispatchEvent:4793
> EventQueue.dispatchEventImpl:766
> EventQueue.access$500:97
> EventQueue$3.run:717
> EventQueue$3.run:711
> AccessController.doPrivileged
> ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege:89
> ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege:99
> EventQueue$4.run:739
> EventQueue$4.run:737
> AccessController.doPrivileged
> ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege:89
> EventQueue.dispatchEvent:736
> TimableEventQueue.dispatchEvent:136
> EventDispatchThread.pumpOneEventForFilters:199
> EventDispatchThread.pumpEventsForFilter:124
> EventDispatchThread.pumpEventsForHierarchy:113
> EventDispatchThread.pumpEvents:109
> EventDispatchThread.pumpEvents:101
> EventDispatchThread.run:90
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists