SessionTokenAuthenticationDetailsProvider httpClient resource leak
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 243
- Forks
- 171
- Avg merge
- 30m
- Merged PRs (30d)
- 4
Description
We're using SessionTokenAuthenticationDetailsProvider for our local development and testing, Noticed that httpClient is not closed during refreshSessionToken.
The snippet causing the leak is as below. Kindly enclose within try or close the http client. Thanks.
`public synchronized boolean refreshSessionToken() {
com.oracle.bmc.Service service =
Services.serviceBuilder().serviceName("auth").serviceEndpointPrefix("auth").build();
String endpoint = Region.formatDefaultRegionEndpoint(service, region);
LOG.debug(
"Refreshing session token, refresh endpoint: {}/v1/authentication/refresh",
endpoint);
try {
HttpClient httpClient =
HttpProvider.getDefault()
.newBuilder()
.baseUri(endpoint)
.registerRequestInterceptor(
Priorities.AUTHENTICATION,
new AuthnClientFilter(
DefaultRequestSigner.createRequestSigner(this),
Collections.emptyMap()))
.build();
SessionTokenRefreshRequest request =
new SessionTokenRefreshRequest((this.sessionToken));`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SessionTokenAuthenticationDetailsProvider.refreshSessionToken(), focusing on the HttpClient created through HttpProvider.getDefault(). Trace the refresh flow and ensure the client is closed when the operation finishes, including failure paths; done means the refresh no longer leaks the HTTP resource.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100