From 4ba355a36d742a55c9f70f7854d362268ae457c3 Mon Sep 17 00:00:00 2001 From: Jorge Bescos Gascon Date: Fri, 4 Oct 2024 11:40:56 +0200 Subject: [PATCH] Netty connector hang up after repeated buffer overflow errors when writing data #5753 (#5755) Signed-off-by: Jorge Bescos Gascon --- .../jersey/netty/connector/internal/JerseyChunkedInput.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/JerseyChunkedInput.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/JerseyChunkedInput.java index e5262d3474..5733c0ff4a 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/JerseyChunkedInput.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/JerseyChunkedInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -208,10 +208,12 @@ private void write(Provider bufferSupplier) throws IOException { try { boolean queued = queue.offer(bufferSupplier.get(), WRITE_TIMEOUT, TimeUnit.MILLISECONDS); if (!queued) { + close(); throw new IOException("Buffer overflow."); } } catch (InterruptedException e) { + close(); throw new IOException(e); } }