You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2025/08/30 12:27:16 UTC
(httpcomponents-core) 01/02: Bug fix: corrected exception propagation by BasicClientExchangeHandler in case of abnormal / premature exchange termination
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
commit bd2b0d66856d502137dc4946f90f7539981a23a8
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Aug 30 14:25:40 2025 +0200
Bug fix: corrected exception propagation by BasicClientExchangeHandler in case of abnormal / premature exchange termination
---
.../hc/core5/http/nio/support/BasicClientExchangeHandler.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java
index 0378a98d7..c74b7d319 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/nio/support/BasicClientExchangeHandler.java
@@ -147,11 +147,13 @@ public void streamEnd(final List<? extends Header> trailers) throws HttpExceptio
@Override
public void failed(final Exception cause) {
try {
- if (inputTerminated.get()) {
+ if (inputTerminated.compareAndSet(false, true)) {
responseConsumer.failed(cause);
+ responseConsumer.releaseResources();
}
- if (!outputTerminated.get()) {
+ if (outputTerminated.compareAndSet(false, true)) {
requestProducer.failed(cause);
+ requestProducer.releaseResources();
}
} finally {
failedInternal(cause);