jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 02/02: Ignore SocketTimeoutException on BinaryTCPClientImpl, when no EOM Byte is set
Date Sat, 09 Jan 2021 17:44:28 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 0ee099997764cab6cc603d26c5ec79957aeaeab1
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Wed Dec 30 12:36:51 2020 +0100

    Ignore SocketTimeoutException on BinaryTCPClientImpl, when no EOM Byte is set
    
    Bugzilla Id: 65034
---
 .../protocol/tcp/sampler/BinaryTCPClientImpl.java      | 18 ++++++++++++------
 xdocs/changes.xml                                      |  3 +++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java
b/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java
index 2971aab..7965271 100644
--- a/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java
+++ b/src/protocol/tcp/src/main/java/org/apache/jmeter/protocol/tcp/sampler/BinaryTCPClientImpl.java
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.SocketTimeoutException;
 
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.util.JMeterUtils;
@@ -133,15 +134,20 @@ public class BinaryTCPClientImpl extends AbstractTCPClient {
                     break;
                 }
             }
-
-            final String hexString = JOrphanUtils.baToHexString(w.toByteArray());
-            if(log.isDebugEnabled()) {
-                log.debug("Read: " + w.size() + "\n" + hexString);
+        } catch (SocketTimeoutException e) {
+            if (useEolByte) {
+                throw new ReadException("Socket timed out while looking for EOM", e,
+                        JOrphanUtils.baToHexString(w.toByteArray()));
             }
-            return hexString;
+            log.debug("Ignoring SocketTimeoutException, as we are not looking for EOM", e);
         } catch (IOException e) {
-            throw new ReadException("", e, JOrphanUtils.baToHexString(w.toByteArray()));
+            throw new ReadException("Problems while trying to read", e, JOrphanUtils.baToHexString(w.toByteArray()));
+        }
+        final String hexString = JOrphanUtils.baToHexString(w.toByteArray());
+        if(log.isDebugEnabled()) {
+            log.debug("Read: {}\n{}", w.size(), hexString);
         }
+        return hexString;
     }
 
 }
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index f39d905..6b65c62 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -148,6 +148,9 @@ Summary
 
 <h3>Other Samplers</h3>
 <ul>
+  <li><bug>65034</bug>Ignore <code>SocketTimeoutException</code>
on <code>BinaryTCPClientImpl</code>, when no EOM Byte is set. Regression
+     introduced by commit c190641e4f0474a34a366a72364b0a8dd25bfc81 which fixed <bug>52104</bug>.
That bug was bout handling
+     the case of waiting for an EOM.</li>
 </ul>
 
 <h3>Controllers</h3>


Mime
View raw message