FSchumacher opened a new pull request, #5870:
URL: https://github.com/apache/jmeter/pull/5870
## Description
Place code, that acts on live AWT components into the AWT thread.
Simplify code, that used recursion to set input parameters. Saw this one,
while looking at the code, that was potentially in the wrong thread.
## Motivation and Context
Try to overcome a deadlock in test suite
When running locally, I observed the following deadlock:
"AWT-EventQueue-1" #23 prio=6 os_prio=0 tid=0x00007f3de9bf6800
nid=0x722b2 waiting for monitor entry [0x00007f3dcb4ee000]
java.lang.Thread.State: BLOCKED (on object monitor)
at
java.awt.Component$AccessibleAWTComponent.getLocationOnScreen(Component.java:9494)
- waiting to lock <0x00000000e0653ef0> (a
java.awt.Component$AWTTreeLock)
at
javax.swing.JComponent$AccessibleJComponent.getLocationOnScreen(JComponent.java:3663)
at
javax.swing.text.JTextComponent$AccessibleJTextComponent.<init>(JTextComponent.java:2516)
at
javax.swing.JEditorPane$AccessibleJEditorPane.<init>(JEditorPane.java:1644)
at
javax.swing.JEditorPane$JEditorPaneAccessibleHypertextSupport.<init>(JEditorPane.java:1971)
at
javax.swing.JEditorPane$AccessibleJEditorPaneHTML.getAccessibleText(JEditorPane.java:1703)
at
org.GNOME.Accessibility.AtkObject.lambda$getTFlagFromObj$0(AtkObject.java:70)
at
org.GNOME.Accessibility.AtkObject$$Lambda$317/331870887.call(Unknown Source)
at org.GNOME.Accessibility.AtkUtil.invokeInSwing(AtkUtil.java:58)
at
org.GNOME.Accessibility.AtkObject.getTFlagFromObj(AtkObject.java:55)
at org.GNOME.Accessibility.AtkWrapper.boundsChanged(Native
Method)
at
org.GNOME.Accessibility.AtkWrapper$3.componentResized(AtkWrapper.java:235)
at
java.awt.AWTEventMulticaster.componentResized(AWTEventMulticaster.java:159)
at java.awt.Component.processComponentEvent(Component.java:6365)
at java.awt.Component.processEvent(Component.java:6319)
at java.awt.Container.processEvent(Container.java:2239)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2297)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at
org.GNOME.Accessibility.AtkWrapper$6.dispatchEvent(AtkWrapper.java:717)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
"Test worker" #1 prio=5 os_prio=0 tid=0x00007f3de8012000 nid=0x7228f
waiting on condition [0x00007f3def695000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000f80386a8> (a
java.util.concurrent.FutureTask)
at
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
at java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.GNOME.Accessibility.AtkUtil.invokeInSwing(AtkUtil.java:68)
at org.GNOME.Accessibility.AtkObject.hashCode(AtkObject.java:234)
at org.GNOME.Accessibility.AtkWrapper.emitSignal(Native Method)
at
org.GNOME.Accessibility.AtkWrapper$5.propertyChange(AtkWrapper.java:557)
at
java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at
javax.accessibility.AccessibleContext.firePropertyChange(AccessibleContext.java:768)
at
javax.swing.JScrollPane$AccessibleJScrollPane.stateChanged(JScrollPane.java:1506)
at javax.swing.JViewport.fireStateChanged(JViewport.java:1369)
at javax.swing.JViewport.reshape(JViewport.java:839)
at java.awt.Component.setBounds(Component.java:2261)
at java.awt.Component.setBounds(Component.java:2405)
at
javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:890)
at java.awt.Container.layout(Container.java:1513)
at java.awt.Container.doLayout(Container.java:1502)
at java.awt.Container.validateTree(Container.java:1698)
at java.awt.Container.validateTree(Container.java:1707)
at java.awt.Container.validateTree(Container.java:1707)
at java.awt.Container.validateTree(Container.java:1707)
at java.awt.Container.validateTree(Container.java:1707)
at java.awt.Container.validate(Container.java:1633)
- locked <0x00000000e0653ef0> (a java.awt.Component$AWTTreeLock)
at
org.apache.jorphan.gui.ComponentUtil.centerComponentInWindow(ComponentUtil.java:67)
at
org.apache.jorphan.gui.ComponentUtil.centerComponentInWindow(ComponentUtil.java:54)
at
org.apache.jmeter.gui.action.SelectTemplatesDialog.init(SelectTemplatesDialog.java:263)
at
org.apache.jmeter.gui.action.SelectTemplatesDialog.<init>(SelectTemplatesDialog.java:105)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.apache.jmeter.junit.JMeterTest.instantiateClass(JMeterTest.java:512)
at
org.apache.jmeter.junit.JMeterTest.getObjects(JMeterTest.java:474)
at
org.apache.jmeter.junit.JMeterTest.suiteSerializableElements(JMeterTest.java:407)
at org.apache.jmeter.junit.JMeterTest.suite(JMeterTest.java:149)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.internal.runners.SuiteMethod.testFromSuiteMethod(SuiteMethod.java:35)
I hope to get rid of this by placing the code to center the newly created
dialog
in the AWT thread.
I believe the deadlock happens only in our test code, when the dialog is
created
and instantaneously destroyed.
## How Has This Been Tested?
Ran the tests a few time and looked at the GUI.
## Types of changes
- Bug fix (non-breaking change which fixes an issue)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that
apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] My code follows the [code style][style-guide] of this project.
[style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]