Skip to content

fix: Don't reopen closed clients in DartWorkerClientImpl. - #19927

Open
gianm wants to merge 1 commit into
apache:masterfrom
gianm:fix-dart-client-race
Open

fix: Don't reopen closed clients in DartWorkerClientImpl.#19927
gianm wants to merge 1 commit into
apache:masterfrom
gianm:fix-dart-client-race

Conversation

@gianm

@gianm gianm commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

DartWorkerClientImpl is scoped to a single query, so there is no need to be able to reopen clients (once a worker fails, the query also fails). Prior to this patch, a client would be reopened if requested after being closed.

This patch fixes a retry loop that could be caused when a server goes away: ControllerMessageListener#serverRemoved calls closeClient, but then the call to stopWorker would cause the client to be re-created and keep retrying until its retries are exhausted.

DartWorkerClientImpl is scoped to a single query, so there is no need
to be able to reopen clients (once a worker fails, the query also
fails).

This patch fixes a retry loop that could be caused when a server goes
away: ControllerMessageListener#serverRemoved calls closeClient, but
then the next call to the worker would cause the client to be re-created
and keep retrying until its retries are exhausted.
@gianm gianm added the Bug label Aug 7, 2026
@github-actions github-actions Bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Aug 7, 2026

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity Findings
P0 0
P1 0
P2 1
P3 0
Total 1
Severity Findings
P0 0
P1 0
P2 1
P3 0
Total 1

Reviewed 5 of 5 changed files. The fix prevents closed worker clients from being reopened, but it introduces unbounded cache growth for unrelated server removals.


This is an automated review by Codex GPT-5.6-Luna(max)

throw DruidException.defensive("%s is closed", getClass().getName());
}

return clientMap.computeIfAbsent(workerId.getHostAndPort(), ignored -> makeNewClient(workerId));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Retains clients for unrelated node removals

DartMessageRelays invokes serverRemoved for every historical node, before controller.hasWorker(...) is checked. This computeIfAbsent therefore creates and retains a closed client/locator for nodes never used by the query; repeated node churn can grow each active query's cache until completion. Avoid retaining entries for unrelated workers while preserving the pre-first-use removal race.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants