Ravisankar Jampani created HTTPCLIENT-2424:
----------------------------------------------
Summary: Http Client leaking memory
Key: HTTPCLIENT-2424
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2424
Project: HttpComponents HttpClient
Issue Type: Test
Components: HttpClient (classic)
Affects Versions: 4.5.14
Environment: java 17
Reporter: Ravisankar Jampani
We have this piece of code,
1. Make http "GET" and receive the response from another service
2. A new client is created for every request and off course within in try with
resources, which ensures the resources are closed.
3) We are observing a memory leak after a very long run.
Could you please confirm if this is candidate for potential memory leak ?
The version 4.5.14.
{code:java}
public String processActionSummaryRequest(String URIPath) {
HttpGet request = new HttpGet(URIPath);
String result = null;
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(controlActionGetApiTimeout * 1000)
.setConnectionRequestTimeout(controlActionGetApiTimeout * 1000)
.setSocketTimeout(controlActionGetApiTimeout * 1000)
.build();
try (CloseableHttpClient httpClient = HttpClients.custom()
.setDefaultRequestConfig(config)
.build();
CloseableHttpResponse httpResponse = httpClient.execute(request)) {
HttpEntity entity = httpResponse.getEntity();
if (entity != null) {
result = EntityUtils.toString(entity);
}
} catch (IOException e) {
throw new EndpointManagementGetControlSignalRetrievalException(
e.getMessage());
}
return result;
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]