From e91619fad7f553140932567ec6606df65551502a Mon Sep 17 00:00:00 2001 From: gregw Date: Tue, 29 Aug 2023 08:56:45 +1000 Subject: [PATCH] Fix #9169 refine idle timeout and failure Only fail request callback if a failure has not been otherwise notified. Slight optimization for failing idle timeouts by avoiding double lock. Always create a failure if failing the callback. --- .../eclipse/jetty/server/internal/HttpChannelState.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java index 26b10bc466ec..d2039954c879 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java @@ -395,13 +395,12 @@ public Runnable onIdleTimeout(TimeoutException t) }); } - // otherwise, we are going to fail the callback, either directly or by a call to onFailure, so ensure all future IO - // operations are failed as well - _failure = Content.Chunk.from(t, true); - - // if there is no failure listener, then we can fail the callback directly without a double lock + // otherwise, if there is no failure listener, then we can fail the callback directly without a double lock if (_onFailure == null && _request != null) + { + _failure = Content.Chunk.from(t, true); return () -> _request._callback.failed(t); + } } }