Bug 57088 - NPE in ResultCollector.testEnded
Summary: NPE in ResultCollector.testEnded
Status: RESOLVED WONTFIX
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 2.11
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-14 11:36 UTC by Philippe Jung
Modified: 2014-10-15 10:35 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Jung 2014-10-14 11:36:01 UTC
In workbench, add a HTTP(S) Recorder, a Recording Controller that is the target chosen in the HTTP(S) Recorder.
Add a View Results in Table in the HTTP(S) Recorder.
Start recording.

When you want to Stop recording, you get the exception at the end of the description.
If you remove the listener from the recorder, you can use Stop button again.

2014/10/14 13:22:44 ERROR - jmeter.JMeter: Uncaught exception:  java.lang.NullPointerException
	at java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:85)
	at java.lang.Runtime.removeShutdownHook(Runtime.java:239)
	at org.apache.jmeter.reporters.ResultCollector.testEnded(ResultCollector.java:269)
	at org.apache.jmeter.reporters.ResultCollector.testEnded(ResultCollector.java:306)
	at org.apache.jmeter.protocol.http.proxy.ProxyControl.notifyTestListenersOfEnd(ProxyControl.java:1192)
	at org.apache.jmeter.protocol.http.proxy.ProxyControl.stopProxy(ProxyControl.java:560)
	at org.apache.jmeter.protocol.http.proxy.gui.ProxyControlGui.actionPerformed(ProxyControlGui.java:365)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6516)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3311)
	at java.awt.Component.processEvent(Component.java:6281)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4872)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
	at java.awt.Container.dispatchEventImpl(Container.java:2273)
	at java.awt.Window.dispatchEventImpl(Window.java:2719)
	at java.awt.Component.dispatchEvent(Component.java:4698)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:694)
	at java.awt.EventQueue$3.run(EventQueue.java:692)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:708)
	at java.awt.EventQueue$4.run(EventQueue.java:706)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Linux Mint 17
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
Comment 1 Sebb 2014-10-14 14:06:23 UTC
I cannot reproduce this.

Can you create a simple JMX file that shows the behaviour?
Comment 2 Philippe Jung 2014-10-14 15:33:32 UTC
Sorry but I cannot reproduce this bug since I restarted JMeter. I remember switching language from French to English but even with this and the mentionned actions, I cannot produce the exception. 

By the way, the bug tracker displays:

"If you are providing the requested information, please change the bug status back to ."

Probably 'NEW' is missing at the end of the sentence

Philippe
Comment 3 Sebb 2014-10-14 16:16:55 UTC
Thanks. I have reported the missing word in the message.

It looks as though the NPE must be caused by a null value for the static field shutdownHook. I cannot see how that can happen. Also, it does not look like this has anything directlty to do with the Recording Controller. 

The problem can only occur if ResultCollector#testEnded() is called, and that is only called at the end of a test run. It is not called during recording as far as I can tell. Further, the variable cannot be null unless testStarted() was not called.

However, given that this has occurred once, it would be sensible to check for null before calling removeShutdownHook().
Comment 4 Sebb 2014-10-14 16:24:02 UTC
URL: http://svn.apache.org/r1631811
Log:
NPE in ResultCollector.testEnded
Bugzilla Id: 57088

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/reporters/ResultCollector.java
    jmeter/trunk/xdocs/changes.xml
Comment 5 Philippe Jung 2014-10-15 07:04:46 UTC
Based on your comments I found a way to reproduce:

Launch JMeter
Add HTTPS Recorder
Add Recording controller (probably not required to reproduce the bug)
Start the HTTPS Recorder
Add a Listener to the HTTPS Recorder
Try to stop it.
Comment 6 Philippe Jung 2014-10-15 07:07:05 UTC
Based on this, I would say the root cause is not fixed: if you add a listener to a already recording recorder, you probably should call some kind of start
Comment 7 Philippe Mouawad 2014-10-15 10:35:34 UTC
Based on your scenario, issue can happen as it is testStarted that initializes ShutdownHook, so since you add it after recording it is null.

So the null check is enough as this scenario is weird and exceptional. You usually add listener before starting recorder.
PS : By the way for recording there is a Template called recording that setups all required config for recording.

If you have another opinion feel free to reopen with proposed solution.
Thanks