Skip to content

Commit ca98ad6

Browse files
committed
HTTPCLIENT-1924: HttpClient to shut down the connection manager if a fatal error occurs in the course of a request execution
1 parent 7c193f6 commit ca98ad6

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

httpclient/src/main/java/org/apache/http/impl/execchain/MainClientExec.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ public CloseableHttpResponse execute(
355355
} catch (final RuntimeException ex) {
356356
connHolder.abortConnection();
357357
throw ex;
358+
} catch (final Error error) {
359+
connManager.shutdown();
360+
throw error;
358361
}
359362
}
360363

httpclient/src/main/java/org/apache/http/impl/execchain/MinimalClientExec.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ public CloseableHttpResponse execute(
247247
} catch (final RuntimeException ex) {
248248
releaseTrigger.abortConnection();
249249
throw ex;
250+
} catch (final Error error) {
251+
connManager.shutdown();
252+
throw error;
250253
}
251254
}
252255

0 commit comments

Comments
 (0)