Skip to content

fix: shut down executeAsync executor#2172

Open
arnabnandy7 wants to merge 1 commit into
googleapis:mainfrom
arnabnandy7:fix/execute-async-thread-leak
Open

fix: shut down executeAsync executor#2172
arnabnandy7 wants to merge 1 commit into
googleapis:mainfrom
arnabnandy7:fix/execute-async-thread-leak

Conversation

@arnabnandy7

Copy link
Copy Markdown

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #2122 ☕️

Description

Shuts down the executor created by the zero-argument HttpRequest.executeAsync() after submitting the request. Previously, every invocation created a fixed thread pool that was never shut down, leaving its worker thread alive indefinitely.

The executor is shut down in a finally block, allowing the submitted request to finish while ensuring its worker thread terminates afterward.

Testing

  • Added a regression test that executes multiple asynchronous requests and verifies that the executor threads terminate.
  • Ran HttpRequestTest: 44 tests passed.
  • Applied Google Java Format.
  • Verified the changes with git diff --check.

No sample code was added.

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@arnabnandy7
arnabnandy7 requested a review from a team as a code owner July 18, 2026 06:21
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HttpRequest#executeAsync leaks a thread on every call

1 participant