Skip to content

Commit fbcb8a2

Browse files
authored
Avoid connection reset error log printed (#16797)
1 parent 36154e5 commit fbcb8a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import java.io.EOFException;
3333
import java.net.SocketAddress;
34+
import java.net.SocketException;
3435
import java.net.SocketTimeoutException;
3536

3637
// https://github.com/apache/thrift/blob/master/doc/specs/thrift-rpc.md
@@ -125,6 +126,10 @@ public int read(byte[] buf, int off, int len) throws TTransportException {
125126
// Read another frame of data
126127
readFrame();
127128
} catch (TTransportException e) {
129+
// Adding this workaround to avoid the Connection reset error log printed.
130+
if (e.getCause() instanceof SocketException && e.getMessage().contains("Connection reset")) {
131+
throw new TTransportException(TTransportException.END_OF_FILE, e.getCause());
132+
}
128133
// There is a bug fixed in Thrift 0.15. Some unnecessary error logs may be printed.
129134
// See https://issues.apache.org/jira/browse/THRIFT-5411 and
130135
// https://github.com/apache/thrift/commit/be20ad7e08fab200391e3eab41acde9da2a4fd07

0 commit comments

Comments
 (0)