Skip to content

[client] Fix inverted awaitTermination condition in LookupClient#close#3328

Open
XuQianJin-Stars wants to merge 1 commit into
apache:mainfrom
XuQianJin-Stars:fix-lookup-client-shutdown-condition
Open

[client] Fix inverted awaitTermination condition in LookupClient#close#3328
XuQianJin-Stars wants to merge 1 commit into
apache:mainfrom
XuQianJin-Stars:fix-lookup-client-shutdown-condition

Conversation

@XuQianJin-Stars
Copy link
Copy Markdown
Contributor

@XuQianJin-Stars XuQianJin-Stars commented May 16, 2026

The shutdown logic in LookupClient#close() had the awaitTermination condition inverted - it called shutdownNow() when the thread pool had already terminated gracefully, and did nothing when it timed out.

This is inconsistent with WriterClient#close() and all other shutdown patterns in the codebase which correctly negate awaitTermination() to trigger shutdownNow() on timeout.

The bug could cause the lookup sender thread pool to not be forcefully terminated when graceful shutdown times out, potentially leading to resource leaks.

Purpose

Fix a logic bug in LookupClient#close() where a missing ! operator caused inverted shutdown behavior for the lookup sender thread pool.

Brief change log

  • Fixed the inverted awaitTermination() condition in LookupClient#close() by adding the missing ! negation operator, making it consistent with WriterClient#close() and the standard ExecutorService shutdown pattern documented in the Java SE docs.

Tests

  • No new tests needed. This is a one-character fix (!) to an existing condition.
  • The correct pattern is already validated by the existing shutdown behavior in WriterClient#close() and RemoteLogManager#shutdownAndAwaitTermination().

API and Format

  • No API or format changes.

Documentation

  • No documentation changes needed.

The shutdown logic in LookupClient#close() had the awaitTermination
condition inverted - it called shutdownNow() when the thread pool had
already terminated gracefully, and did nothing when it timed out.

This is inconsistent with WriterClient#close() and all other shutdown
patterns in the codebase which correctly negate awaitTermination() to
trigger shutdownNow() on timeout.

The bug could cause the lookup sender thread pool to not be forcefully
terminated when graceful shutdown times out, potentially leading to
resource leaks.
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