You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2020/03/17 19:08:23 UTC

[Bug 64236] New: JMeter startup: MenuFactory#initializeMenus creates lots of irrelevant Swing objects

https://bz.apache.org/bugzilla/show_bug.cgi?id=64236

            Bug ID: 64236
           Summary: JMeter startup: MenuFactory#initializeMenus creates
                    lots of irrelevant Swing objects
           Product: JMeter
           Version: 5.2.1
          Hardware: PC
                OS: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: sitnikov.vladimir@gmail.com
  Target Milestone: JMETER_5.3.0

MenuFactory#initializeMenus is called during startup, and it takes ~3 seconds
to execute.

What it needs is just "Collection<String> getMenuCategories()", however,
in order to call the method, it creates an instance of the class,
so it instantiates all the Swing objects since 99% of JMeterGUIComponent
implementations create Swing objects in constructor :(

That is a major time consumer during JMeter startup.


In theory, it would be great to decouple metadata from UI: move metadata to
another interface, or replace it with a static method, or use annotations or
whatever.


Sample stacktrace (from https://bz.apache.org/bugzilla/show_bug.cgi?id=62653 ):


java.lang.NullPointerException: null
        at
javax.swing.plaf.metal.MetalFileChooserUI$IndentIcon.getIconWidth(MetalFileChooserUI.java:891)
~[?:1.8.0_181]
        at
javax.swing.SwingUtilities.layoutCompoundLabelImpl(SwingUtilities.java:968)
~[?:1.8.0_181]
        at
javax.swing.SwingUtilities.layoutCompoundLabel(SwingUtilities.java:895)
~[?:1.8.0_181]
        at javax.swing.plaf.basic.BasicLabelUI.layoutCL(BasicLabelUI.java:102)
~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(BasicLabelUI.java:256)
~[?:1.8.0_181]
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1662)
~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1363)
~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1311)
~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicListUI$Handler.valueChanged(BasicListUI.java:2623)
~[?:1.8.0_181]
        at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184)
~[?:1.8.0_181]
        at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:164)
~[?:1.8.0_181]
        at
javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:211)
~[?:1.8.0_181]
        at
javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:405)
~[?:1.8.0_181]
        at
javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:415)
~[?:1.8.0_181]
        at
javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:459)
~[?:1.8.0_181]
        at javax.swing.JList.setSelectedIndex(JList.java:2216) ~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicComboPopup.setListSelection(BasicComboPopup.java:1186)
~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicComboPopup.access$300(BasicComboPopup.java:65)
~[?:1.8.0_181]
        at
javax.swing.plaf.basic.BasicComboPopup$Handler.itemStateChanged(BasicComboPopup.java:1015)
~[?:1.8.0_181]
        at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1223)
~[?:1.8.0_181]
        at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1280)
~[?:1.8.0_181]
        at javax.swing.JComboBox.contentsChanged(JComboBox.java:1330)
~[?:1.8.0_181]
        at
javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:118)
~[?:1.8.0_181]
        at
javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.setSelectedItem(MetalFileChooserUI.java:1009)
~[?:1.8.0_181]
        at
javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(MetalFileChooserUI.java:980)
~[?:1.8.0_181]
        at
javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.access$800(MetalFileChooserUI.java:910)
~[?:1.8.0_181]
        at
javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(MetalFileChooserUI.java:659)
~[?:1.8.0_181]
        at
javax.swing.plaf.metal.MetalFileChooserUI.access$1100(MetalFileChooserUI.java:53)
~[?:1.8.0_181]
        at
javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(MetalFileChooserUI.java:748)
~[?:1.8.0_181]
        at
java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
~[?:1.8.0_181]
        at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
~[?:1.8.0_181]
        at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
~[?:1.8.0_181]
        at java.awt.Component.firePropertyChange(Component.java:8434)
~[?:1.8.0_181]
        at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:598)
~[?:1.8.0_181]
        at javax.swing.JFileChooser.<init>(JFileChooser.java:344)
~[?:1.8.0_181]
        at javax.swing.JFileChooser.<init>(JFileChooser.java:296)
~[?:1.8.0_181]
        at
org.apache.jmeter.protocol.smtp.sampler.gui.SmtpPanel.initComponents(SmtpPanel.java:576)
~[ApacheJMeter_mail.jar:4.0 r1823414]
        at
org.apache.jmeter.protocol.smtp.sampler.gui.SmtpPanel.<init>(SmtpPanel.java:117)
~[ApacheJMeter_mail.jar:4.0 r1823414]
        at
org.apache.jmeter.protocol.smtp.sampler.gui.SmtpSamplerGui.makeDataPanel(SmtpSamplerGui.java:190)
~[ApacheJMeter_mail.jar:4.0 r1823414]
        at
org.apache.jmeter.protocol.smtp.sampler.gui.SmtpSamplerGui.init(SmtpSamplerGui.java:170)
~[ApacheJMeter_mail.jar:4.0 r1823414]
        at
org.apache.jmeter.protocol.smtp.sampler.gui.SmtpSamplerGui.<init>(SmtpSamplerGui.java:47)
~[ApacheJMeter_mail.jar:4.0 r1823414]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) ~[?:1.8.0_181]
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
~[?:1.8.0_181]
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
~[?:1.8.0_181]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
~[?:1.8.0_181]
        at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_181]
        at
org.apache.jmeter.gui.util.MenuFactory.getGUIComponent(MenuFactory.java:174)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.gui.util.MenuFactory.initializeMenus(MenuFactory.java:141)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.gui.util.MenuFactory.<clinit>(MenuFactory.java:106)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:92)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:155)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:46)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at
org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:70)
~[ApacheJMeter_core.jar:4.0 r1823414]
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
[?:1.8.0_181]

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64236] JMeter startup: MenuFactory#initializeMenus creates lots of irrelevant Swing objects

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64236

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           Keywords|                            |FixedInTrunk
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
             Status|NEW                         |RESOLVED
           Hardware|PC                          |All

--- Comment #1 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
This has been implemented within https://github.com/apache/jmeter/pull/573

-- 
You are receiving this mail because:
You are the assignee for the bug.