Skip to content

Commit 5eeea8c

Browse files
authored
Log failure in internalSend (#131602)
An exception here should be impossible, but we don't assert that, nor do we emit a log message to prove it didn't happen in a production environment. This commit adds the missing log and assert. Backport of #131418 to `8.18`
1 parent 41b1be5 commit 5eeea8c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.elasticsearch.TransportVersions;
1919
import org.elasticsearch.action.ActionListener;
2020
import org.elasticsearch.cluster.node.DiscoveryNode;
21+
import org.elasticsearch.common.Strings;
2122
import org.elasticsearch.common.bytes.BytesReference;
2223
import org.elasticsearch.common.io.stream.RecyclerBytesStreamOutput;
2324
import org.elasticsearch.common.network.CloseableChannel;
@@ -293,6 +294,16 @@ private void maybeLogSlowMessage(boolean success) {
293294
}
294295
});
295296
} catch (RuntimeException ex) {
297+
logger.error(
298+
Strings.format(
299+
"unexpected exception calling sendMessage for transport message [%s] of size [%d] on [%s]",
300+
message,
301+
messageSize,
302+
channel
303+
),
304+
ex
305+
);
306+
assert Thread.currentThread().getName().startsWith("TEST-") : ex;
296307
Releasables.closeExpectNoException(() -> listener.onFailure(ex), () -> CloseableChannel.closeChannel(channel));
297308
throw ex;
298309
}

0 commit comments

Comments
 (0)