Bug 52104 - TCP Sampler handles badly errors
TCP Sampler handles badly errors
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.5.1
All All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks: 40750
  Show dependency tree
 
Reported: 2011-10-27 16:57 UTC by Philippe Mouawad
Modified: 2011-11-10 08:27 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2011-10-27 16:57:04 UTC
Currently, when an IOException occurs or subclasses, these errors are ignored in implementations of TCPClient interface:
BinaryTCPClientImpl:
- SocketTimeoutException is ignored => an incomplete result is returned
- InterruptedIOException is ignored => an incomplete result is returned
- IOException is handled => an empty result is returned (sampler interprets it as OK response)
resulting in Samplers 

Same for TCPClientImpl, and for LengthPrefixedBinaryTCPClientImpl it ignores IOException and returns incomplete response.
Comment 1 Philippe Mouawad 2011-10-27 20:44:43 UTC
Also fixed NPE in TCPSampler:
 if an exception occurs , setSoTimeout will throw NPE if init fails

Date: Thu Oct 27 20:45:11 2011
New Revision: 1190014

URL: http://svn.apache.org/viewvc?rev=1190014&view=rev
Log:
Bug 52104 - TCP Sampler handles badly errors

Modified:
   jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java
   jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java
   jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPClient.java
   jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPClientImpl.java
   jakarta/jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 2 Sebb 2011-11-04 11:43:11 UTC
I'm not sure it's the best solution to throw an IOException on read() errors

If a response is truncated or otherwise incomplete, it might still contain useful information. This information was previously returned.

Maybe there should be some kind of status code returned from read (e.g. Throwable?)

Perhaps this could be a separate method (with default implementation in the abstract class).

Thoughts?
Comment 3 Sebb 2011-11-04 11:44:21 UTC
See also Bug 52087
Comment 4 Philippe Mouawad 2011-11-04 21:07:51 UTC
(In reply to comment #2)
> I'm not sure it's the best solution to throw an IOException on read() errors
> 
> If a response is truncated or otherwise incomplete, it might still contain
> useful information. This information was previously returned.
> 
But Sample was marked OK while it was in Error.

> Maybe there should be some kind of status code returned from read (e.g.
> Throwable?)

I don't understand what you mean. Do you want to provide what was partially read ? 

> 
> Perhaps this could be a separate method (with default implementation in the
> abstract class).
> 
> Thoughts?
Comment 5 Sebb 2011-11-04 22:00:14 UTC
Yes, I think it would be useful to provide the partial response, but it should be marked as in error.
Comment 6 Philippe Mouawad 2011-11-10 08:27:00 UTC
Date: Thu Nov 10 08:25:32 2011
New Revision: 1200210

URL: http://svn.apache.org/viewvc?rev=1200210&view=rev
Log:
Bug 52104 - TCP Sampler handles badly errors
Bug 52087 - TCPClient interface does not allow for partial reads

Added:
   jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/ReadException.java   (with props)
Modified:
   jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java
   jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/LengthPrefixedBinaryTCPClientImpl.java
   jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPClient.java
   jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPClientImpl.java
   jmeter/trunk/src/protocol/tcp/org/apache/jmeter/protocol/tcp/sampler/TCPSampler.java
   jmeter/trunk/xdocs/changes.xml