Bug 45199 - Proxy inserts "${}" before each character in every string recorded.
Summary: Proxy inserts "${}" before each character in every string recorded.
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.3.1
Hardware: PC Windows XP
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL: http://www.k-plus-s.com
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-13 01:22 UTC by Achim Westermann
Modified: 2008-06-14 07:34 UTC (History)
1 user (show)



Attachments
screenshot of recorded samples (64.38 KB, image/png)
2008-06-13 01:22 UTC, Achim Westermann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Achim Westermann 2008-06-13 01:22:12 UTC
Created attachment 22122 [details]
screenshot of recorded samples

Setup: 

Version: 2.3.1 started with proxy settings via command line. 
OS:  XP
Java :  1.6.0_06-b02 
Browser:  Firefox 2.0.0.14
Browser:  Internet Explorer 6.0.29xxx 
Websites: http://www.k-plus-s.com, http://jakarta.apache.org/jmeter/

C:\java\jakarta-jmeter-2.3.1\bin>jmeter.bat -H http-proxy-xxxxx.net -P 8080 -N localhost


Actions: 

A proxy on port 9090 was set up with an inclusion of '.*' and started. Both browswers were tested. Every character that was recorded was filled prefixed by ${} like shown in the screenshot. 

Result: 
The jmeter.log looks OK: 

2008/06/13 10:04:14 INFO  - jmeter.protocol.http.proxy.Daemon: Creating Daemon Socket... on port 9090 
2008/06/13 10:04:14 INFO  - jmeter.protocol.http.proxy.Daemon: Proxy up and running! 


The following stacktrace is shown on the console: 

Exception in thread "Thread-7" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
        at java.lang.AbstractStringBuilder.append(Unknown Source)
        at java.lang.StringBuffer.append(Unknown Source)
        at org.apache.jmeter.util.StringUtilities.substitute(StringUtilities.java:47)
        at org.apache.jmeter.engine.util.ReplaceFunctionsWithStrings.transformValue(ReplaceFunctionsWithStrings.java:92)
        at org.apache.jmeter.engine.util.ValueReplacer.replaceValues(ValueReplacer.java:121)
        at org.apache.jmeter.engine.util.ValueReplacer.reverseReplace(ValueReplacer.java:85)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.replaceValues(ProxyControl.java:867)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.deliverSampler(ProxyControl.java:385)
        at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:241)
Exception in thread "Thread-22" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
        at java.lang.AbstractStringBuilder.append(Unknown Source)
        at java.lang.StringBuffer.append(Unknown Source)
        at org.apache.jmeter.util.StringUtilities.substitute(StringUtilities.java:47)
        at org.apache.jmeter.engine.util.ReplaceFunctionsWithStrings.transformValue(ReplaceFunctionsWithStrings.java:92)
        at org.apache.jmeter.engine.util.ValueReplacer.replaceValues(ValueReplacer.java:121)
        at org.apache.jmeter.engine.util.ValueReplacer.reverseReplace(ValueReplacer.java:85)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.replaceValues(ProxyControl.java:867)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.deliverSampler(ProxyControl.java:385)
        at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:241)
Exception in thread "Thread-24" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
        at java.lang.AbstractStringBuilder.append(Unknown Source)
        at java.lang.StringBuffer.append(Unknown Source)
        at org.apache.jmeter.util.StringUtilities.substitute(StringUtilities.java:47)
        at org.apache.jmeter.engine.util.ReplaceFunctionsWithStrings.transformValue(ReplaceFunctionsWithStrings.java:92)
        at org.apache.jmeter.engine.util.ValueReplacer.replaceValues(ValueReplacer.java:121)
        at org.apache.jmeter.engine.util.ValueReplacer.reverseReplace(ValueReplacer.java:85)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.replaceValues(ProxyControl.java:867)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.deliverSampler(ProxyControl.java:385)
        at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:241)
Exception in thread "Thread-23" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
        at java.lang.AbstractStringBuilder.append(Unknown Source)
        at java.lang.StringBuffer.append(Unknown Source)
        at org.apache.jmeter.util.StringUtilities.substitute(StringUtilities.java:47)
        at org.apache.jmeter.engine.util.ReplaceFunctionsWithStrings.transformValue(ReplaceFunctionsWithStrings.java:92)
        at org.apache.jmeter.engine.util.ValueReplacer.replaceValues(ValueReplacer.java:121)
        at org.apache.jmeter.engine.util.ValueReplacer.reverseReplace(ValueReplacer.java:85)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.replaceValues(ProxyControl.java:867)
        at org.apache.jmeter.protocol.http.proxy.ProxyControl.deliverSampler(ProxyControl.java:385)
        at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:241)
Exception in thread "Thread-21" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-20" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-19" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-18" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-17" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-16" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-15" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-14" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-12" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-13" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-11" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-8" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-10" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-9" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-69" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-67" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-68" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-66" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-65" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-64" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-63" java.lang.OutOfMemoryError: Java heap space
Comment 1 Achim Westermann 2008-06-13 01:41:21 UTC
The comman "set HEAP=-Xms256m -Xmx1024m" in jmeter.bat shows the same result. The java process takes up to 1 GB. 

In the proxy settings of JMeter the checkbox "regex matching" had to be checked or nothing would be recored, even if the browser used the JMeter proxy (stopping it would cause the browser to fail getting a response). 
Comment 2 Sebb 2008-06-13 02:18:59 UTC
Regex matching has nothing to do with the proxy recording itself.

It only affects how the requests are processed when replacing variables.

Have you defined any variables on the Test Plan?

It looks like the variable replacer has been confused by something.
Comment 3 Achim Westermann 2008-06-13 02:43:52 UTC
Hi Sebb, 

I narrowed it down a bit. 
I did not define any variables. 

I found out that this happens when my Thread Group has a "View Result Tree" Listener attached while recording. If I remove it, recording works fine. 

So: 

- Add a Thread Group
- Add a Proxy to the workplace. Change nothing but port to 9090 (should not matter) and select the Target Controller "testplanname -> Thread Group. 
- Add a Listener of type "View Result Tree". 

- Start the proxy. 
- Point your browser to localhost:9090 in proxy settings. 

-> After clicking the first link, cpu load rises and after approx. 20 seconds on a core 2 duo 2GHZ, 2GB RAM the 1 GB limit is reached and you should get the exception. 

kind regards, 

Achim
Comment 4 Sebb 2008-06-13 03:00:02 UTC
Just tried that, and it works fine for me when testing against www.apache.org, Google and BBC news.

Does it happen to you for these sites?
Or only some sites?

Are you still using the JMeter command-line proxy settings?

If so, can you try it without?


BTW, if you want to see the pages as they are recorded by the proxy, add the listener to the proxy server.
Comment 5 Achim Westermann 2008-06-13 03:39:52 UTC
Thanks for your patience. 

This time I took more time to isolate the error. It seems to be as you said in first place.

- Just click the add button in the top - level test plan. A user defined var is created. Leave it empty. 

- Now start the proxy session. Record to a Thread group. 

--> The error should occur. 

- This happens also when starting JMeter without proxy settings (had to test with localhost tomcat). 


kind regards, 

Achim
Comment 6 Bill 2008-06-13 16:31:43 UTC
I just spent a long and frustrating day debugging my script to find this bug: ${} insertion and "out of memory" error. Please fix this bug!
Comment 7 Sebb 2008-06-13 18:36:22 UTC
Fixed in SVN r66718
Comment 8 Achim Westermann 2008-06-14 07:34:45 UTC
Thanks a lot!
Comment 9 The ASF infrastructure team 2022-09-24 20:37:41 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2125