Bug 46148 - HTTP sampler fails on SSL requests when logging for jmeter.util is set to DEBUG
HTTP sampler fails on SSL requests when logging for jmeter.util is set to DEBUG
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.3.2
All All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-11-05 00:47 UTC by Håvard Wigtil
Modified: 2008-11-05 07:04 UTC (History)
0 users



Attachments
Simple test that gets an exception when log_level.jmeter.util is set to DEBUG (7.43 KB, text/plain)
2008-11-05 00:47 UTC, Håvard Wigtil
Details
Log file from the test (17.10 KB, text/plain)
2008-11-05 00:48 UTC, Håvard Wigtil
Details
jmeter.properties (26.15 KB, text/plain)
2008-11-05 00:48 UTC, Håvard Wigtil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Håvard Wigtil 2008-11-05 00:47:25 UTC
Created attachment 22830 [details]
Simple test that gets an exception when log_level.jmeter.util is set to DEBUG

If I set "log_level.jmeter.util=DEBUG" in jmeter.properties, SSL requests in HTTP Sampler fails with an exception. If log_level.jmeter.util is set to INFO or not explicitly set, everything works as it should.

This is the stack trace I get as "Response data":
javax.net.ssl.SSLException: Received fatal alert: unexpected_message
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at java.net.HttpURLConnection.getResponseCode(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
	at org.apache.jmeter.protocol.http.sampler.HTTPSampler.readResponse(HTTPSampler.java:233)
	at org.apache.jmeter.protocol.http.sampler.HTTPSampler.sample(HTTPSampler.java:463)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1021)
	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1007)
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:290)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.net.ssl.SSLException: Received fatal alert: unexpected_message
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source)
	at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source)
	at java.io.BufferedInputStream.fill(Unknown Source)
	at java.io.BufferedInputStream.read1(Unknown Source)
	at java.io.BufferedInputStream.read(Unknown Source)
	at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
	at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
	at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
	at java.net.URLConnection.getHeaderFieldInt(Unknown Source)
	at java.net.URLConnection.getContentLength(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentLength(Unknown Source)
	at org.apache.jmeter.protocol.http.sampler.HTTPSampler.readResponse(HTTPSampler.java:203)
	... 5 more
Comment 1 Håvard Wigtil 2008-11-05 00:48:25 UTC
Created attachment 22831 [details]
Log file from the test
Comment 2 Håvard Wigtil 2008-11-05 00:48:45 UTC
Created attachment 22832 [details]
jmeter.properties
Comment 3 Sebb 2008-11-05 05:41:34 UTC
The problem is the debug in HttpSSLProtocolSocketFactory; if you turn that off using

log_level.jmeter.util.HttpSSLProtocolSocketFactory=INFO

then the test works OK.

There is a comment in the debug code that says:

            /* Warning: the next line seems to cause the error
            * javax.net.ssl.SSLException: Received fatal alert: unexpected_message
            * with certain sites
            */
            SSLSession sslSession = sock.getSession();

Looks like that debug message should be removed.
Comment 4 Sebb 2008-11-05 07:04:26 UTC
The getSession() method may initiate the handshake, which is presumably what causes the problem.

The offending code has been removed:

URL: http://svn.apache.org/viewvc?rev=711582&view=rev
Log:
Bug 46148 - HTTP sampler fails on SSL requests when logging for jmeter.util is set to DEBUG
Remove the debug code, as it has side effects


Thanks for reporting the problem.