Bug 61395 - Large server response truncation can impact recording

Truncating responses over 10MB by default was a bad idea. 
It is better to disable it by default and have the option available if needed.
Bugzilla Id: 61395

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1808160 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Philippe Mouawad 2017-09-12 20:26:38 +00:00
parent e54cb94c28
commit 94a16706c7
4 changed files with 12 additions and 7 deletions

View File

@ -953,8 +953,8 @@ beanshell.server.file=../extras/startup.bsh
# Max size of bytes stored in memory per SampleResult
# Ensure you don't exceed max capacity of a Java Array and remember
# that the higher it is, the higher JMeter will consume heap
# Defaults to 10MB
#httpsampler.max_bytes_to_store_per_request=10485760
# Defaults to 0, which means no truncation
#httpsampler.max_bytes_to_store_per_request=0
# Max size of buffer in bytes used when reading responses
# Defaults to 64k

View File

@ -192,7 +192,7 @@ public abstract class HTTPSamplerBase extends AbstractSampler
public static final boolean BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT = false; // The default setting to be used (i.e. historic)
private static final int MAX_BYTES_TO_STORE_PER_REQUEST =
JMeterUtils.getPropDefault("httpsampler.max_bytes_to_store_per_request", 10 * 1024 *1024); // $NON-NLS-1$ // default value: 10MB
JMeterUtils.getPropDefault("httpsampler.max_bytes_to_store_per_request", 0); // $NON-NLS-1$ // default value: 0 don't truncate
private static final int MAX_BUFFER_SIZE =
JMeterUtils.getPropDefault("httpsampler.max_buffer_size", 65 * 1024); // $NON-NLS-1$
@ -1827,8 +1827,9 @@ public abstract class HTTPSamplerBase extends AbstractSampler
if (md == null) {
if(storeInBOS) {
if(totalBytes+bytesReadInBuffer<=MAX_BYTES_TO_STORE_PER_REQUEST
|| JMeterContextService.getContext().isRecording()) {
if(MAX_BYTES_TO_STORE_PER_REQUEST <= 0 ||
(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);

View File

@ -63,7 +63,10 @@ Summary
<!-- <figure width="846" height="613" image="changes/3.0/view_results_tree_search_feature.png"></figure> -->
<ch_section>IMPORTANT CHANGES</ch_section>
HTTP Sampler now supports Brotli compression. A long standing bug that occured when more than one TableEditor were used, was eventually tackled. The constant <code>DEFAULT_IMPLEMENTATION</code> was removed from CookieManager, as it lost it purpose with the removal of the alternate HTTP Client implementation in the last release
HTTP Sampler now supports Brotli compression.
A long standing bug that occured when more than one TableEditor were used, was eventually tackled.
The constant <code>DEFAULT_IMPLEMENTATION</code> was removed from CookieManager,
as it lost it purpose with the removal of the alternate HTTP Client implementation in the last release
<ch_title>Core improvements</ch_title>
@ -85,6 +88,7 @@ Incorporated feed back about unclear documentation.
<li>In InfluxDbBackendListenerClient, <code>statut</code> property has been renamed to <code>status</code></li>
<li>In CookieManager, <code>DEFAULT_IMPLEMENTATION</code> and <code>DEFAULT_IMPLEMENTATION</code> constants are now private.
<note>If you're using <code>ignorecookies</code> with HC3CookieHandler (&lt; JMeter 3.1) configuration will be reset, ensure you put it back.</note></li>
<li>JMeter will not truncate anymore by default responses exceeding 10 MB. If you want to enable this truncation, see property <code>httpsampler.max_bytes_to_store_per_request</code></li>
<h3>Removed elements or functions</h3>
<li><code>_StringFromFile</code> function has been dropped, use <code><funclink name="__StringFromFile"/></code> instead</li>
<h3>Logging changes</h3>

View File

@ -1236,7 +1236,7 @@ JMETER-SERVER</source>
Max size of bytes stored in memory per <code>SampleResult</code>. Ensure that you
don't exceed the maximum capacity of a Java Array and remember that the higher you
set this value, the more memory JMeter will consume.<br/>
Defaults to: <code>10485760</code> bytes
Defaults to: <code>0</code> bytes which means no truncation will occur
</property>
<property name="httpsampler.max_buffer_size">
Max size of buffer in bytes used when reading responses.<br/>