You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2017/09/07 20:57:35 UTC
svn commit: r1807649 - in /jmeter/trunk: src/core/org/apache/jmeter/threads/
src/protocol/http/org/apache/jmeter/protocol/http/proxy/
src/protocol/http/org/apache/jmeter/protocol/http/sampler/ xdocs/
Author: pmouawad
Date: Thu Sep 7 20:57:35 2017
New Revision: 1807649
URL: http://svn.apache.org/viewvc?rev=1807649&view=rev
Log:
Bug 61395 - Large server response truncation can impact recording
Bugzilla Id: 61395
Modified:
jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java?rev=1807649&r1=1807648&r2=1807649&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterContext.java Thu Sep 7 20:57:35 2017
@@ -54,6 +54,8 @@ public class JMeterContext {
private ConcurrentHashMap<String, Object> samplerContext = new ConcurrentHashMap<>(5);
+ private boolean recording;
+
JMeterContext() {
clear0();
}
@@ -70,6 +72,7 @@ public class JMeterContext {
samplingStarted = false;
threadNum = 0;
thread = null;
+ recording = false;
samplerContext.clear();
}
@@ -201,4 +204,18 @@ public class JMeterContext {
public Map<String, Object> getSamplerContext() {
return samplerContext;
}
+
+ /**
+ * param recording true if we are recording
+ */
+ public void setRecording(boolean recording) {
+ this.recording = recording;
+ }
+
+ /**
+ * @return the recording
+ */
+ public boolean isRecording() {
+ return recording;
+ }
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1807649&r1=1807648&r2=1807649&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Thu Sep 7 20:57:35 2017
@@ -50,6 +50,7 @@ import org.apache.jmeter.protocol.http.u
import org.apache.jmeter.protocol.http.util.HTTPConstants;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.util.JMeterUtils;
import org.slf4j.LoggerFactory;
import org.apache.jorphan.util.JMeterException;
@@ -171,6 +172,7 @@ public class Proxy extends Thread {
}
SamplerCreator samplerCreator = null;
try {
+ JMeterContextService.getContext().setRecording(true);
// Now, parse initial request (in case it is a CONNECT request)
byte[] ba = request.parse(new BufferedInputStream(clientSocket.getInputStream()));
if (ba.length == 0) {
@@ -303,6 +305,7 @@ public class Proxy extends Thread {
if(sampler != null) {
sampler.threadFinished(); // Needed for HTTPSampler2
}
+ JMeterContextService.getContext().setRecording(false);
}
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1807649&r1=1807648&r2=1807649&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java Thu Sep 7 20:57:35 2017
@@ -1827,9 +1827,11 @@ public abstract class HTTPSamplerBase ex
if (md == null) {
if(storeInBOS) {
- if(totalBytes+bytesReadInBuffer<=MAX_BYTES_TO_STORE_PER_REQUEST) {
+ if(totalBytes+bytesReadInBuffer<=MAX_BYTES_TO_STORE_PER_REQUEST
+ || JMeterContextService.getContext().isRecording()) {
w.write(readBuffer, 0, bytesReadInBuffer);
} else {
+ log.debug("Big response, truncating it to {} bytes", MAX_BYTES_TO_STORE_PER_REQUEST);
w.write(readBuffer, 0, (int)(MAX_BYTES_TO_STORE_PER_REQUEST-totalBytes));
storeInBOS = false;
}
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1807649&r1=1807648&r2=1807649&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Sep 7 20:57:35 2017
@@ -179,6 +179,7 @@ Incorporated feed back about unclear doc
The charset was added sometime back while refactoring to use a newer api of http client.
See <bug>56141</bug> for more info.</li>
<li><bug>61456</bug>java.lang.ArrayIndexOutOfBoundsException when recording with JMeter and weird Basic Auth Authorization header</li>
+ <li><bug>61395</bug>Large server response truncation can impact recording</li>
</ul>
<h3>Other Samplers</h3>