Bug 65417 - org.apache.jmeter.services.FileServer not providing correct base dir path on JMeter server (load generator in distributed setup)
Summary: org.apache.jmeter.services.FileServer not providing correct base dir path on ...
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 5.4.1
Hardware: PC Linux
: P2 major (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-01 07:39 UTC by Madhuri Jain
Modified: 2021-07-01 07:39 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Madhuri Jain 2021-07-01 07:39:14 UTC
We're running JMeter distributed setup and have created an alpine-based jre-headless docker image containing JMeter v5.4.1.

There's a groovy script in our JMeter test plan using JSR223PostProcessor which is simply logging the FileServer base dir path and it runs fine on testing both JMeter client and server running on same PC or in single docker container:

Groovy Script: 

import org.apache.jmeter.services.FileServer
def inputPath = FileServer.getFileServer().getBaseDir()
log.info(inputPath);

Result:
2021-06-30 17:09:20,491 INFO o.a.j.e.J.JSR223 PostProcessor: /root/artifacts

While running the same test plan using same docker image with JMeter client and server running on separate docker containers (on same or different machines), it shows the following path on JMeter SERVER (taken from worker/JMeter server logs):

2021-06-30 17:09:20,488 INFO o.a.j.e.J.JSR223 PostProcessor: /root/artifacts/root/artifacts

This is incorrect (repeated path) and is critical as we have a logic to access a file to populate POST body in HTTP request which throws FileNotFoundException.

2021-06-30 17:09:20,489 WARN o.a.j.f.Groovy: Error running groovy script
javax.script.ScriptException: javax.script.ScriptException: java.io.FileNotFoundException: /root/artifacts/root/artifacts/message.json (No such file or directory)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) ~[groovy-jsr223-3.0.7.jar:3.0.7]
        at javax.script.AbstractScriptEngine.eval(Unknown Source) ~[java.scripting:?]
        at org.apache.jmeter.functions.Groovy.execute(Groovy.java:120) [ApacheJMeter_functions.jar:5.4.1]
        at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:113) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:100) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:280) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.config.Argument.getValue(Argument.java:145) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgument.java:249) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgument.java:230) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.setupHttpEntityEnclosingRequestData(HTTPHC4Impl.java:1643) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:886) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:641) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285) [ApacheJMeter_http.jar:5.4.1]
        at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:5.4.1]
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
        at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: javax.script.ScriptException: java.io.FileNotFoundException: /root/artifacts/root/artifacts/message.json (No such file or directory)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) ~[groovy-jsr223-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ~[groovy-jsr223-3.0.7.jar:3.0.7]
        ... 20 more
Caused by: java.io.FileNotFoundException: /root/artifacts/root/artifacts/message.json (No such file or directory)
        at java.io.FileInputStream.open0(Native Method) ~[?:?]
        at java.io.FileInputStream.open(Unknown Source) ~[?:?]
        at java.io.FileInputStream.<init>(Unknown Source) ~[?:?]
        at groovy.util.CharsetToolkit.<init>(CharsetToolkit.java:78) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.runtime.ResourceGroovyMethods.newReader(ResourceGroovyMethods.java:1780) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.runtime.ResourceGroovyMethods.getText(ResourceGroovyMethods.java:591) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.runtime.dgm$1040.doMethodInvoke(Unknown Source) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.reflection.GeneratedMetaMethod$Proxy.doMethodInvoke(GeneratedMetaMethod.java:83) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.runtime.metaclass.MethodMetaProperty$GetBeanMethodMetaProperty.getProperty(MethodMetaProperty.java:76) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63) ~[groovy-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:329) ~[groovy-3.0.7.jar:3.0.7]
        at Script1.run(Script1.groovy:1) ~[?:?]
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ~[groovy-jsr223-3.0.7.jar:3.0.7]
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ~[groovy-jsr223-3.0.7.jar:3.0.7]
        ... 20 more

Also, please suggest any workaround if feasible by the time this is investigated.