Bug 54685 - ArrayIndexOutOfBoundsException if "sample_variable" is set in client but not server
Summary: ArrayIndexOutOfBoundsException if "sample_variable" is set in client but not ...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.9
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-13 09:33 UTC by Danny Lade
Modified: 2013-03-28 01:13 UTC (History)
0 users



Attachments
a log full of exceptions ... (71.91 KB, application/octet-stream)
2013-03-26 14:05 UTC, Danny Lade
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Danny Lade 2013-03-13 09:33:10 UTC
I set the jmeter property "sample_variable" to a variable name I wan't to send optionally. But if the variable is not available during the load test, the following exception occurs:

2013/03/13 02:39:13 ERROR - jmeter.samplers.BatchSampleSender: testEnded(host) java.rmi.ServerError: Error occurred in s
erver thread; nested exception is:
        org.apache.jorphan.util.JMeterError: Check the sample_variable settings!
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:333)
        at sun.rmi.transport.Transport$1.run(Transport.java:159)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
        at org.apache.jmeter.samplers.RemoteSampleListenerImpl_Stub.processBatch(Unknown Source)
        at org.apache.jmeter.samplers.BatchSampleSender.testEnded(BatchSampleSender.java:125)
        at org.apache.jmeter.samplers.DataStrippingSampleSender.testEnded(DataStrippingSampleSender.java:70)
        at org.apache.jmeter.samplers.RemoteListenerWrapper.testEnded(RemoteListenerWrapper.java:99)
        at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfEnd(StandardJMeterEngine.java:223)
        at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:437)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.jorphan.util.JMeterError: Check the sample_variable settings!
        at org.apache.jmeter.samplers.SampleEvent.getVarValue(SampleEvent.java:159)
        at org.apache.jmeter.save.converters.SampleResultConverter.setAttributes(SampleResultConverter.java:286)
        at org.apache.jmeter.save.converters.SampleResultConverter.marshal(SampleResultConverter.java:117)
        at com.thoughtworks.xstream.core.TreeMarshaller.convert(TreeMarshaller.java:70)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
        at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
        at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
        at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
        at com.thoughtworks.xstream.XStream.marshal(XStream.java:894)
        at org.apache.jmeter.save.SaveService.saveSampleResult(SaveService.java:359)
        at org.apache.jmeter.reporters.ResultCollector.sampleOccurred(ResultCollector.java:507)
        at org.apache.jmeter.samplers.RemoteSampleListenerImpl.processBatch(RemoteSampleListenerImpl.java:96)
        at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
        at sun.rmi.transport.Transport$1.run(Transport.java:159)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        ... 1 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at org.apache.jmeter.samplers.SampleEvent.getVarValue(SampleEvent.java:157)
        ... 24 more
Comment 1 Sebb 2013-03-17 00:11:23 UTC
AFAICT this error is caused by a mismatch between the variable names used by client/server instances; not by a missing variable value.

However I don't see how this can happen normally, as the client sends the list to all the servers.

Have you got the logs for all the client and server instances?
If so, please search for instances of the string

sample_variables

in all the logs for a failed run and report the matches here.
Comment 2 Danny Lade 2013-03-26 08:52:23 UTC
Ok, you're right. 

If I don't set the property "sample_variable" in either remote or client settings the problem occurs. 

But then IMHO the bug is, that this value can not be configured by client only, as the most other properties allow.

And on the other hand no Exception should be thrown but an error message to the log would be more helpful.
Comment 3 Sebb 2013-03-26 11:09:54 UTC
(In reply to comment #2)
> Ok, you're right. 
> 
> If I don't set the property "sample_variable" in either remote or client
> settings the problem occurs. 

I have not been able to reproduce that.

> But then IMHO the bug is, that this value can not be configured by client
> only, as the most other properties allow.

The variable needs to be the same on all the systems, which is why the client sends the same list to all the remote servers.

> And on the other hand no Exception should be thrown but an error message to
> the log would be more helpful.

JMeter already does log the problem with full stacktrace.
Until we find a cause, it's not clear whether the test can be allowed to carry on.
Comment 4 Danny Lade 2013-03-26 14:05:57 UTC
Created attachment 30103 [details]
a log full of exceptions ...

I currently reproduced it simply:

1. I set "sample_variables=foobar" at jmeter-client/bin/jmeter.properties
2. I set "#sample_variables" at jmeter-server/bin/jmeter.properties
3. started remote jmeter by jmeter-server/bin/jmeter-server.bat
4. started a test with UI using jmeter-client for it

I got a log full of exceptions ...
Comment 5 Danny Lade 2013-03-26 14:08:10 UTC
It could be quiet easy to fix if because these variables are just optional ones.

IMO there is no need for this exception.
Comment 6 Sebb 2013-03-26 14:33:01 UTC
We need the client log as well.

For some reason the sample_variables property does not seem to being propagated.

Also, the first part of the server log is missing.
Comment 7 Sebb 2013-03-26 17:01:10 UTC
I have now managed to reproduce the problem.

Investigating.
Comment 8 Sebb 2013-03-27 00:33:28 UTC
Looks like the problem is partly one of timing: the properties are passed across, but the class that uses them has already been loaded and has already fetched the value of the property.

However, that is not the only problem: it should be possible to change the variable names between test runs.

The work-round is to ensure eaxctly the same set of variables is defined in every JMeter instance. [This is obviously error-prone, which is why the client tries to tell the servers what variables to save at test startup].
Comment 9 Sebb 2013-03-28 01:13:08 UTC
URL: http://svn.apache.org/r1461911
Log:
ArrayIndexOutOfBoundsException if "sample_variable" is set in client but not server
Bugzilla Id: 54685

Added:
    jmeter/trunk/bin/testfiles/Bug54685.csv
    jmeter/trunk/bin/testfiles/Bug54685.jmx   (with props)
    jmeter/trunk/bin/testfiles/Bug54685.xml   (with props)
Modified:
    jmeter/trunk/build.xml
    jmeter/trunk/src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
    jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleEvent.java
    jmeter/trunk/xdocs/changes.xml
Comment 10 The ASF infrastructure team 2022-09-24 20:37:53 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3074