Skip to content

Clear callbacks after connection failures - #1155

Open
omrzk wants to merge 1 commit into
Blizzard:masterfrom
omrzk:fix/clear-failed-connection-callbacks-1143
Open

omrzk wants to merge 1 commit into
Blizzard:masterfrom
omrzk:fix/clear-failed-connection-callbacks-1143

Conversation

@omrzk

@omrzk omrzk commented Nov 14, 2026

Copy link
Copy Markdown

Each failed connect() attempt registers another copy of the native event and delivery callbacks. After brokers become reachable, one produced message can emit several identical delivery reports. Remove the failed attempt's callbacks before returning its error so the next attempt registers one copy.

Fixes #1143.

Validation: the new regression uses librdkafka's in-process mock cluster and the real native addon, injecting three initial metadata failures. It receives four reports for one message on current master and one with the fix, then disconnects and reconnects the same producer and verifies one report for its next message. npm test passes all 104 tests on Node 22.23.2/Linux. The native addon builds with two jobs. The new test passes JSHint; make jslint retains preexisting findings, including the same missing semicolons at lib/client.js:65 and :70 on master.

This is an in-process mock broker and injected metadata-failure test, not testing against a deployed Kafka cluster. Native Windows/macOS and the other Node versions were not run locally.

This branch has not been deployed

No deployments
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.

Duplicated delivery reports received after multiple reconnects to Kafka

1 participant