浏览代码

Log failure in `internalSend` (#131418) (#131600)

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.
David Turner 1 月之前
父节点
当前提交
081bb4cc4e
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      server/src/main/java/org/elasticsearch/transport/OutboundHandler.java

+ 10 - 0
server/src/main/java/org/elasticsearch/transport/OutboundHandler.java

@@ -433,6 +433,16 @@ public final class OutboundHandler {
                 }
             });
         } catch (RuntimeException ex) {
+            logger.error(
+                Strings.format(
+                    "unexpected exception calling sendMessage for transport message [%s] of size [%d] on [%s]",
+                    messageDescription.get(),
+                    messageSize,
+                    channel
+                ),
+                ex
+            );
+            assert Thread.currentThread().getName().startsWith("TEST-") : ex;
             channel.setCloseException(ex);
             Releasables.closeExpectNoException(() -> listener.onFailure(ex), () -> CloseableChannel.closeChannel(channel));
             throw ex;