Skip to content

KAFKA-20393: Fix stickyNode using stale IP when broker address changes#21983

Merged
apoorvmittal10 merged 2 commits intoapache:trunkfrom
kwondh5217:KAFKA-20393
Apr 9, 2026
Merged

KAFKA-20393: Fix stickyNode using stale IP when broker address changes#21983
apoorvmittal10 merged 2 commits intoapache:trunkfrom
kwondh5217:KAFKA-20393

Conversation

@kwondh5217
Copy link
Copy Markdown
Contributor

@kwondh5217 kwondh5217 commented Apr 7, 2026

When a broker's IP address changes (e.g., pod replacement in
Kubernetes), TelemetrySender.stickyNode retains a stale Node
object with the old address. Since canSendRequest() checks by node
ID only, the stale connection passes the check and telemetry data is
sent to the wrong host.

This PR refreshes stickyNode against current metadata at the start of
TelemetrySender.maybeUpdate(). If the node's address has changed,
stickyNode is updated to the fresh Node. If the node no longer
exists in metadata, stickyNode is cleared and reconnect backoff is
returned.

Reviewers: Apoorv Mittal apoorvmittal10@gmail.com

Signed-off-by: Daeho Kwon <trewq231@naver.com>
@github-actions github-actions bot added triage PRs from the community clients labels Apr 7, 2026
@github-actions github-actions bot removed the triage PRs from the community label Apr 8, 2026
@apoorvmittal10 apoorvmittal10 self-requested a review April 8, 2026 09:06
Copy link
Copy Markdown
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR and fix, I have left some comments.

Signed-off-by: Daeho Kwon <trewq231@naver.com>
Copy link
Copy Markdown
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, LGTM. I ll merge once build completes.

@kwondh5217
Copy link
Copy Markdown
Contributor Author

@apoorvmittal10 , Thank you for the review!

@apoorvmittal10 apoorvmittal10 merged commit 123ee9e into apache:trunk Apr 9, 2026
22 checks passed
apoorvmittal10 pushed a commit that referenced this pull request Apr 9, 2026
#21983)

When a broker's IP address changes (e.g., pod replacement in
Kubernetes),
`TelemetrySender.stickyNode` retains a stale `Node` object with the old
address. Since `canSendRequest()` checks by node ID only, the stale
connection passes the check and telemetry data is sent to the wrong
host.

This PR refreshes `stickyNode` against current metadata at the start of 
`TelemetrySender.maybeUpdate()`. If the node's address has changed, 
`stickyNode` is updated to the fresh `Node`. If the node no longer
exists
in metadata, `stickyNode` is cleared and reconnect backoff is returned. 

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>

---------

Signed-off-by: Daeho Kwon <trewq231@naver.com>
@apoorvmittal10
Copy link
Copy Markdown
Contributor

Cherry-picked to 4.2 branch as well.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants