This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 01c15d4b160e1abcc67dcbc3a79a69b015922e9f Author: Ken Hu <[email protected]> AuthorDate: Mon Jul 6 20:13:39 2026 -0700 Set error before signaling reader for inactive connection in Java GLV CTR Changing the order to setting the error in the ResultSet to prevent a race between the handler and the reader on who sets the error first in the case of a closed connection. This matches what is done in exceptionCaught(). This prevents a flaky test shouldHandlePartialContentClose(). --- .../gremlin/driver/handler/HttpStreamingResponseHandler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpStreamingResponseHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpStreamingResponseHandler.java index b7bce47f64..1beb726564 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpStreamingResponseHandler.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpStreamingResponseHandler.java @@ -172,11 +172,15 @@ public class HttpStreamingResponseHandler extends MessageToMessageDecoder<HttpOb @Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { + // Signal end-of-stream only AFTER super.channelInactive so the pending request is marked errored (by the + // downstream GremlinResponseHandler) before the reader thread is unblocked. Otherwise the reader can win the + // race with an EOFException from the closed stream. This change matches how errors are handled in + // exceptionCaught() which is to mark the ResultSet before signaling the stream. + releaseErrorBody(); + super.channelInactive(ctx); if (queueInputStream != null) { queueInputStream.signalEndOfStream(); } - releaseErrorBody(); - super.channelInactive(ctx); } @Override
