Skip to content

SessionTokenAuthenticationDetailsProvider httpClient resource leak #652

@mbalamaruthu

Description

@mbalamaruthu

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));`

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDKIssue pertains to the SDK itself and not specific to any service

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions