Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AjpSampler throws java.lang.StringIndexOutOfBoundsException #2477

Closed
asfimport opened this issue Mar 23, 2011 · 3 comments
Closed

AjpSampler throws java.lang.StringIndexOutOfBoundsException #2477

asfimport opened this issue Mar 23, 2011 · 3 comments

Comments

@asfimport
Copy link
Collaborator

Rebeccah (Bug 50963):
I've googled and can find very little about JMeter and AJP other than the existance of an AJP1.3 sampler; certainly nothing resembling what I am seeing.

I have tomcat running behind IIS over AJP 1.3, with IIS/Windows handling user authentication using the Windows domain authentication. Rather than load test our domain controller's authentication function, I thought I would test tomcat itself over the AJP connector. I have the Tomcat AJP connector set to port 8009 with SSL redirect to port 443; any other connector settings are at default. All of the pages of the web application under test have a security-constraint requiring SSL encryption. JMeter testing using the tomcat HTTP and HTTPS ports (which will eventually be firewalled off) works fine. I have used a standalone commandline AJPClient to confirm that I can communicate over our intranet with tomcat using AJP and get a 200 status code.

I create a new JMeter test plan from scratch:

  • one Thread Group, containing
  • one AJPSampler
    • https protocol
    • port 8009
    • 60000ms timeouts
    • my desired hostname and web page
    • follow redirects (or redirect automatically, same results either way)
    • use keep-alive
  • one Response Assertion that checks for a 200 status code
  • a View Results Tree Listener
    I save and then run the test plan
    From the UI standpoint, nothing happens. The sampler never shows up in the view.

Next, I take an existing test plan and edit the element tag for the sampler to reflect an AjpSampler instead of an HTTPSampler:

  • change
    <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="Grp1 Calculator web form HTTP Request" enabled="true">...</HTTPSampler>
    to
    <AjpSampler guiclass="AjpSamplerGui" testclass="AjpSampler" testname="Grp1 Calculator web form AJP/1.3" enabled="true">...</AjpSampler>
    I save and then run the test plan
    In the UI, this sampler fails with a null response.

In both cases, when I look at the JMeter log file, I see:

2011/03/23 15:16:23 ERROR - jmeter.threads.JMeterThread: Error while processing sampler 'AJP/1.3 Sampler - MSScalculator app' : java.lang.StringIndexOutOfBoundsException: String index out of range: 41099
at java.lang.String.checkBounds(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.AjpSampler.getString(AjpSampler.java:499)
at org.apache.jmeter.protocol.http.sampler.AjpSampler.parseHeaders(AjpSampler.java:443)
at org.apache.jmeter.protocol.http.sampler.AjpSampler.handshake(AjpSampler.java:392)
at org.apache.jmeter.protocol.http.sampler.AjpSampler.execute(AjpSampler.java:381)
at org.apache.jmeter.protocol.http.sampler.AjpSampler.sample(AjpSampler.java:112)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:965)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:951)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:348)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:243)
at java.lang.Thread.run(Unknown Source)

If I create another AJP sampler in the UI change the protocol from https to http and change the target path to the tomcat manager app, I get the same UI behavior and the same exception with a different out-of-range index value (41086).

Severity: normal
OS: Windows XP

@asfimport
Copy link
Collaborator Author

Rebeccah (migrated from Bugzilla):
I just realized, the exception I am reporting in AjpSampler is identical to the one reported in Bug 47242 Comment 6, in the AJP commandline client code that Ken Van Camp was asking for (and that I downloaded from that thread to confirm I had AJP access across my Intranet).

In that thread, chamith buddhika did post a patch for the commandline AJP client last April. Perhaps it can be incorporated into JMeter?

Thanks,

Rebeccah

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
I've found one bug, which is that the code fails to skip past the control integer used for header translation, so the value is then used as the length for the next String.

Not sure if that is the same bug as in Bug 47242 - there's rather a lot of code to scan to see if it is.

URL: http://svn.apache.org/viewvc?rev=1084822&view=rev
Log:
#2477 - AjpSampler throws java.lang.StringIndexOutOfBoundsException

Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AjpSampler.java
jakarta/jmeter/trunk/xdocs/changes.xml

The code is in nightly builds from r1084822.

@asfimport
Copy link
Collaborator Author

Rebeccah (migrated from Bugzilla):
Thank you very much for jumping on this so quickly.

Rebeccah

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

No branches or pull requests

1 participant