Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null pointer exception on stop Threads command (Run>Stop) #2391

Closed
asfimport opened this issue Aug 10, 2010 · 3 comments
Closed

Null pointer exception on stop Threads command (Run>Stop) #2391

asfimport opened this issue Aug 10, 2010 · 3 comments

Comments

@asfimport
Copy link
Collaborator

stef (Bug 49734):
Some times when asking jmeter to stop a running thread group a null pointer exception is thrown and the window saying "Stopping Threads" remains displayed.
The exception is:
Exception in thread "Thread-357" java.lang.NullPointerException
at org.apache.jmeter.engine.StandardJMeterEngine.tellThreadsToStop(StandardJMeterEngine.java:542)
at org.apache.jmeter.engine.StandardJMeterEngine.access$700(StandardJMeterEngine.java:57)
at org.apache.jmeter.engine.StandardJMeterEngine$StopTest.run(StandardJMeterEngine.java:357)
at java.lang.Thread.run(Unknown Source)

It seams a null check on the Thread object retreived should be done in this method:

private void tellThreadsToStop() {
    synchronized (allThreads) { // Protect iterator
        Iterator<JMeterThread> iter = new HashSet<JMeterThread>(allThreads.keySet()).iterator();
        while (iter.hasNext()) {
            JMeterThread item = iter.next();
            item.stop(); // set stop flag
            item.interrupt(); // interrupt sampler if possible
            Thread t = allThreads.get(item);
            t.interrupt(); // also interrupt JVM thread           // <-- Line 542
        }
    }
}

Regards,

Stephane

Severity: major
OS: Windows XP

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Thanks for the report; fixed in SVN:

URL: http://svn.apache.org/viewvc?rev=986020&view=rev
Log:
#2391 - Null pointer exception on stop Threads command (Run>Stop)

Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
jakarta/jmeter/trunk/xdocs/changes.xml

@asfimport
Copy link
Collaborator Author

Cheng Chi (migrated from Bugzilla):
(In reply to comment 1)

Thanks for the report; fixed in SVN:

URL: http://svn.apache.org/viewvc?rev=986020&view=rev
Log:
#2391 - Null pointer exception on stop Threads command (Run>Stop)

Modified:

jakarta/jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
jakarta/jmeter/trunk/xdocs/changes.xml

Hi, Sebb,

The Fix is confused, can you explain why t can be 'null' here or shall we need to dig the root cause deeper? :)

if (t != null ) { // #2391
t.interrupt(); // also interrupt JVM thread
}

Thanks!
Cheng Chi

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
See the original bug report stack trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant