kafka-node: apiSupport uncaught exception when a node disconnects and broker.apiSupport comes empty
Hi,
On high load we’re getting an uncaught error:
apiSupport is empty
That is related to: https://github.com/SOHU-Co/kafka-node/issues/750, it’s suppoused to be fix but we’re still experiencing some problems, we had a look at the code and we think that in kafkaClient.js file for the sendRequest method you shoud try / catch this when you call the sendToBroker method, something like this
... try { sendToBroker(payload, leader, callback); } catch (ex) { callback(ex); } ...
Bug Report
Environment
- Node version: 8.11.1
- Kafka-node version: 2.6.1
- Kafka version: 0.11
For specific cases also provide
- Number of Brokers: 3
- Number partitions for topic: 3
Include Sample Code to reproduce behavior
Just gave load to a KafkaClient producing messages and cut off some broker. You should see the uncaught error.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 15
Commits related to this issue
- Fixed issue where closed broker could be used to send metadata request closes #995 — committed to SOHU-Co/kafka-node by hyperlink 5 years ago
- Fixed issue where closed broker could be used to send metadata request closes #995 (#1160) — committed to SOHU-Co/kafka-node by hyperlink 5 years ago
this issue still exists i keep getting
apiSupport is emptyif broker is not availablekafka-node : 4.0.2
Similar issue here, able to reproduce by trying to connect to kafka/zookeeper when its down.
Looks to be caused when connecting calls loadMetadataForTopics() which fails to handle an error thrown by getSupportedForRequestType().
Have tested changing the loadMetadataForTopics() to prove the idea, and it works: