From a2b78f1be2d8a1b9ad39b588f41ae8db2bb5f9d1 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 1 Aug 2017 14:21:49 +0200 Subject: [PATCH] Fixes #1703 - Improve HttpInput failure logging. --- .../java/org/eclipse/jetty/server/HttpInput.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java index 85738788f67..0fcdb5dcffc 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java @@ -626,9 +626,20 @@ public class HttpInput extends ServletInputStream implements Runnable synchronized (_inputQ) { if (_state instanceof ErrorState) - LOG.warn(x); + { + // Log both the original and current failure + // without modifying the original failure. + Throwable failure = new Throwable(((ErrorState)_state).getError()); + failure.addSuppressed(x); + LOG.warn(failure); + } else + { + // Add a suppressed throwable to capture this stack + // trace without wrapping/hiding the original failure. + x.addSuppressed(new Throwable("HttpInput failure")); _state = new ErrorState(x); + } if (_listener == null) _inputQ.notify();