Skip to content

Conversation

@FSchumacher
Copy link
Contributor

Description

Should fix large responses/requests in ViewResultRreader when no linebreaks can be found

Motivation and Context

As described in #6336 JMeter seems to crash, when large request bodies are used in HTTP sampler. This is caused by the used TextArea, which tries to find a good place for breaking and uses too much CPU for this.

One fix, we tried earlier, was to add linebreaks, when large responses are shown. We forgot about requests.
This fix is basically two fixes.

  1. There seems to be a bug in our StringWrap class, that does the insertion of linebreaks.
  2. Move the use of StringWrap into the problematic JSyntaxTextArea, so that all data that is shown by the problematic component is automatically wrapped with linebreaks.

If this fix seems to help, we could remove the usage of StringWrap in the old places.

How Has This Been Tested?

Used a simple test plan, that generates a HTTP body with ${__groovy("abc" * 1_000_000)}. Without this patch, JMeter seems to be crashed. With the fix, it will be responsive (after a short while).

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    This will insert linebreaks in large data chunks that are displayed with JSyntaxTextArea

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.

@bhecquet
Copy link

You saved my day
I've compiled and tested your JMeter version with my project, sending a 400kb JSON
With default configuration, there is still a freeze of about 1 minute
But, when a set

view.results.tree.max_line_size=1000
view.results.tree.soft_wrap_line_size=1000
view.results.tree.max_size=1048576
view.results.tree.simple_view_limit=1000

Then, everything is OK, no more waits

From the above settings, I cannot tell which one helps

@bigrck64
Copy link

Hi Felix 😄

I feel this is the exact solution for my problem too !
Very long line without space inside freeze the "view result tree" GUI for minuts on jMeter 5.6.3.

So I downloaded latest valid 6.0.0 snapshot but I feel your modification was not merged yet.
https://ci-builds.apache.org/job/JMeter/job/JMeter-trunk/970/

I don't have any build env ATM, do you know if I can download jmeter binaries >= 5.6.3 with your fix somewhere ?
Thanks !

Comment on lines +298 to +304
// Default limited to 110K
private static final int MAX_LINE_SIZE =
JMeterUtils.getPropDefault("view.results.tree.max_line_size", 110_000); // $NON-NLS-1$

// Limit the soft wrap to 100K (hard limit divided by 1.1)
private static final int SOFT_WRAP_LINE_SIZE =
JMeterUtils.getPropDefault("view.results.tree.soft_wrap_line_size", (int) (MAX_LINE_SIZE / 1.1f)); // $NON-NLS-1$
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why duplicating the properties? I guess those properties are not needed here


@Override
public void setText(String t) {
super.setText(wrapLongLines(t));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT of org.apache.jmeter.visualizers.ViewResultsFullVisualizer.wrapLongLines(t)?
It might make sense moving wrapLongLines to a different class.

// Try adding the next line if it does not exceed maxWrap
int next = nextLineSeparator;
if (next != -1 && pos - next <= maxWrap) {
if (next != -1 && next - pos <= maxWrap) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test to cover the change?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants