Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/next-release/bugfix-Apache5HTTPClient-2866d44.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "Apache 5 HTTP Client",
"contributor": "",
"description": "Fixed an issue in the Apache 5 HTTP client where requests could fail with `\"Endpoint not acquired / already released\"`. These failures are now converted to retryable I/O errors."
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,15 @@ private HttpExecuteResponse execute(HttpUriRequestBase apacheRequest, MetricColl
HttpHost target = determineTarget(apacheRequest);
ClassicHttpResponse httpResponse = httpClient.executeOpen(target, apacheRequest, localRequestContext);
return createResponse(httpResponse, apacheRequest);
} catch (IllegalStateException e) {
// TODO: remove this when a permanent fix is made upstream
// This is a workaround for a race condition where a connection is not properly acquired when httpClient attempts
// to execute a request on a connection from the pool. For now, we rethrow this as an IOException so upper layers
// have a chance to retry if possible
if ("Endpoint not acquired / already released".equals(e.getMessage())) {
throw new IOException("Failed to execute HTTP request", e);
}
throw e;
} finally {
THREAD_LOCAL_REQUEST_METRIC_COLLECTOR.remove();
}
Expand Down
Loading