Skip to content

Commit 98504ea

Browse files
authored
Drop ReceiveTimeoutTransportException stack trace (#75671)
We only create a `ReceiveTimeoutTransportException` in one place, the timeout handler for the corresponding transport request, so the stack trace contains no useful information and just adds noise if ever it is logged. With this commit we drop the stack trace from these exceptions.
1 parent b6efb38 commit 98504ea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

server/src/main/java/org/elasticsearch/transport/ReceiveTimeoutTransportException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ public ReceiveTimeoutTransportException(StreamInput in) throws IOException {
2323
super(in);
2424
}
2525

26+
@Override
27+
public synchronized Throwable fillInStackTrace() {
28+
// stack trace is uninformative
29+
return this;
30+
}
2631
}

test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ public void handleResponse(StringMessageResponse response) {
933933
@Override
934934
public void handleException(TransportException exp) {
935935
assertThat(exp, instanceOf(ReceiveTimeoutTransportException.class));
936+
assertThat(exp.getStackTrace().length, equalTo(0));
936937
}
937938
});
938939

@@ -992,6 +993,7 @@ public void handleResponse(StringMessageResponse response) {
992993
public void handleException(TransportException exp) {
993994
latch.countDown();
994995
assertThat(exp, instanceOf(ReceiveTimeoutTransportException.class));
996+
assertThat(exp.getStackTrace().length, equalTo(0));
995997
}
996998
});
997999

@@ -1580,6 +1582,7 @@ public void handleResponse(StringMessageResponse response) {
15801582
@Override
15811583
public void handleException(TransportException exp) {
15821584
assertThat(exp, instanceOf(ReceiveTimeoutTransportException.class));
1585+
assertThat(exp.getStackTrace().length, equalTo(0));
15831586
}
15841587
});
15851588

0 commit comments

Comments
 (0)