Skip to content

fix: Reuse HttpClient instance instead of creating one per authorize …#2

Closed
vikshab wants to merge 1 commit intomainfrom
DIN-8-fixing-http-client-in-release_0.7.0
Closed

fix: Reuse HttpClient instance instead of creating one per authorize …#2
vikshab wants to merge 1 commit intomainfrom
DIN-8-fixing-http-client-in-release_0.7.0

Conversation

@vikshab
Copy link
Copy Markdown

@vikshab vikshab commented Mar 28, 2026

Ticket

Fixes
stackabletech#142 issue

Problem
Each call to OpaAuthorizer.authorize() creates a new HttpClient via HttpClient.newHttpClient(). Every HttpClient spawns a SelectorManager background thread and its own connection pool that are never shut down, causing unbounded thread growth under load.

Fix
Move HttpClient to an instance field initialized once in the constructor. HttpClient is thread-safe and designed to be reused — a single instance handles all concurrent requests via its internal connection pool, eliminating the thread leak

Note:
I created this branch from the realease/0.7.0 tag specifically. See available tags with commits here https://github.com/stackabletech/druid-opa-authorizer/tags

git checkout -b DIN-8-fixing-http-client-in-release_0.7.0 cb5d92e

Built a release with fix https://github.com/webflow/druid-opa-authorizer/releases/tag/release%2F0.7.0-webflow0

TODO's before closing PR

  • I'm thinking we will just cherry pick our changes into main w/o merging it, since our branch was based of release/0.7.0
git checkout main
git cherry-pick 8a1b726                                                                                                                                             
git push origin main 

…call

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vikshab vikshab requested a review from a team March 28, 2026 18:23
@vikshab vikshab closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant