Skip to content

[fix][broker] Avoid false WARN log when replicator is already terminated#25259

Open
Denovo1998 wants to merge 1 commit intoapache:masterfrom
Denovo1998:replicator_terminated_log_warn
Open

[fix][broker] Avoid false WARN log when replicator is already terminated#25259
Denovo1998 wants to merge 1 commit intoapache:masterfrom
Denovo1998:replicator_terminated_log_warn

Conversation

@Denovo1998
Copy link
Contributor

@Denovo1998 Denovo1998 commented Feb 25, 2026

Fixes #xyz

Main Issue: #xyz

PIP: #xyz

Motivation

AbstractReplicator.closeProducerAsync can race with termination. In the post-close callback, the state check mixed two different state snapshots, so a normal transition to Terminated could be misclassified and logged as an unexpected WARN. This creates noisy logs and makes concurrent shutdown behavior harder to reason about.

Modifications

  • Fixed the terminated-state branch condition in AbstractReplicator to consistently use setDisconnectedRes when evaluating Terminating/Terminated.
  • Kept the close/termination state machine behavior unchanged, and only corrected the condition used for log-path selection.
  • Added testCloseProducerAsyncNoWarnWhenAlreadyTerminated to cover the race where another thread sets the replicator state to Terminated while producer.closeAsync() is still in progress.
  • Asserted that no unexpected WARN log is emitted and that the expected INFO log path is used.

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: Denovo1998#21

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

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants