oracle / oracle/oci-java-sdk

X509FederationClient httpClient resource leak

Open
#651 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SDK
Dominant language
Java
Stars
243
Forks
171
Avg merge
30m
Merged PRs (30d)
4

Description

We're using InstancePrincipalsAuthenticationDetailsProvider as part of our canary test run with MicronautTest. Since the test is run periodically, we've observed a resource leak, where live threads increase for each canary run.

The resource leak seems to be com.oracle.bmc.auth.internal.X509FederationClient leaving a leaked httpClient. This may need to be closed at something similar to preDestroy in Micronaut or make X509FederationClient closeable. Thanks.

The client causing resource leak snippet is as below.

this.httpClient = HttpProvider.getDefault() .newBuilder() .baseUri(URI.create(federationEndpoint)) .property(StandardClientProperties.ASYNC_POOL_SIZE, 1) .registerRequestInterceptor( Priorities.AUTHENTICATION, new AuthnClientFilter( new RequestSignerImpl( keySupplier, SigningStrategy.STANDARD, keyIdSupplier), Collections.emptyMap())) .registerRequestInterceptor( Priorities.HEADER_DECORATOR, new ClientIdFilter()) .registerRequestInterceptor(Priorities.USER, new LogHeadersFilter()) .build(); this.circuitBreaker = CircuitBreakerHelper.makeCircuitBreaker(this.httpClient, circuitBreakerConfig);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at X509FederationClient and the InstancePrincipalsAuthenticationDetailsProvider usage shown in the issue; trace how the httpClient and circuitBreaker are created and owned. Reproduce the leak with repeated MicronautTest canary runs, then verify that the client resources are released during the appropriate lifecycle or close operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.