You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "FSchumacher (via GitHub)" <gi...@apache.org> on 2023/04/29 19:49:12 UTC

[GitHub] [jmeter] FSchumacher opened a new pull request, #5870: Deadlock in testsuite

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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] vlsi commented on pull request #5870: Deadlock in testsuite

Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on PR #5870:
URL: https://github.com/apache/jmeter/pull/5870#issuecomment-1528862759

   Checkerframework has GUI Effect Checker: https://checkerframework.org/manual/#guieffect-checker
   
   I wonder if it would work in JMeter code.
   However, in my experience, Checkerframework's nullability checker is extremely slow.


-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher commented on a diff in pull request #5870: Deadlock in testsuite

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on code in PR #5870:
URL: https://github.com/apache/jmeter/pull/5870#discussion_r1181206507


##########
src/core/src/main/java/org/apache/jmeter/gui/action/SelectTemplatesDialog.java:
##########
@@ -260,7 +261,9 @@ public void windowClosing(WindowEvent evt){
 
         this.pack();
         this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT));
-        ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size
+        SwingUtilities.invokeLater(() ->
+            ComponentUtil.centerComponentInWindow(this, 50) // center position and 50% of screen size
+        );
         populateTemplatePage();

Review Comment:
   I adapted JMeterTest, to create all classes in the AWT thread. That is probably a bit saner.



-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] vlsi commented on a diff in pull request #5870: Deadlock in testsuite

Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on code in PR #5870:
URL: https://github.com/apache/jmeter/pull/5870#discussion_r1181217663


##########
src/core/src/main/java/org/apache/jmeter/gui/action/SelectTemplatesDialog.java:
##########
@@ -260,7 +261,9 @@ public void windowClosing(WindowEvent evt){
 
         this.pack();
         this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT));
-        ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size
+        SwingUtilities.invokeLater(() ->
+            ComponentUtil.centerComponentInWindow(this, 50) // center position and 50% of screen size
+        );
         populateTemplatePage();

Review Comment:
   Indeed, creating all the instances in AWT thread looks better in that test.



-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] vlsi commented on a diff in pull request #5870: Deadlock in testsuite

Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on code in PR #5870:
URL: https://github.com/apache/jmeter/pull/5870#discussion_r1181125830


##########
src/core/src/main/java/org/apache/jmeter/gui/action/SelectTemplatesDialog.java:
##########
@@ -260,7 +261,9 @@ public void windowClosing(WindowEvent evt){
 
         this.pack();
         this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT));
-        ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size
+        SwingUtilities.invokeLater(() ->
+            ComponentUtil.centerComponentInWindow(this, 50) // center position and 50% of screen size
+        );
         populateTemplatePage();

Review Comment:
   I've no idea. I would move it just in case. However, it might look all the others need to be on the UI thread. Should we create the class on the UI thread in the first place?



-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher commented on a diff in pull request #5870: Deadlock in testsuite

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher commented on code in PR #5870:
URL: https://github.com/apache/jmeter/pull/5870#discussion_r1181123428


##########
src/core/src/main/java/org/apache/jmeter/gui/action/SelectTemplatesDialog.java:
##########
@@ -260,7 +261,9 @@ public void windowClosing(WindowEvent evt){
 
         this.pack();
         this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT));
-        ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size
+        SwingUtilities.invokeLater(() ->
+            ComponentUtil.centerComponentInWindow(this, 50) // center position and 50% of screen size
+        );
         populateTemplatePage();

Review Comment:
   Yes, I thought of that and I thought about moving it up in the code, as it is setText and getText, only. That should be safe, shouldn't it?



-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] vlsi commented on a diff in pull request #5870: Deadlock in testsuite

Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on code in PR #5870:
URL: https://github.com/apache/jmeter/pull/5870#discussion_r1181122916


##########
src/core/src/main/java/org/apache/jmeter/gui/action/SelectTemplatesDialog.java:
##########
@@ -260,7 +261,9 @@ public void windowClosing(WindowEvent evt){
 
         this.pack();
         this.setMinimumSize(new Dimension(MINIMAL_BOX_WIDTH, MINIMAL_BOX_HEIGHT));
-        ComponentUtil.centerComponentInWindow(this, 50); // center position and 50% of screen size
+        SwingUtilities.invokeLater(() ->
+            ComponentUtil.centerComponentInWindow(this, 50) // center position and 50% of screen size
+        );
         populateTemplatePage();

Review Comment:
   populateTemplatePage seems to be a UI method as well.
   WDYT of moving it inside `invokeLater` above?



-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [jmeter] FSchumacher merged pull request #5870: Deadlock in testsuite

Posted by "FSchumacher (via GitHub)" <gi...@apache.org>.
FSchumacher merged PR #5870:
URL: https://github.com/apache/jmeter/pull/5870


-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org