kafkajs
kafkajs copied to clipboard
UncaughtException with Consumer Runner
Describe the bug Consumer runner calls https://github.com/tulios/kafkajs/blob/a733eaa2f215c8d763da4a595c50f65fcd050566/src/consumer/runner.js#L90 without an await, or a catch block. This seems to cause the exception thrown in https://github.com/tulios/kafkajs/blob/a733eaa2f215c8d763da4a595c50f65fcd050566/src/consumer/runner.js#L112 become uncaught.
2022-06-10T18:38:26.771Z error: uncaughtException: The coordinator is loading and hence can't process requests for this group
KafkaJSProtocolError: The coordinator is loading and hence can't process requests for this group
at createErrorFromCode (/test/node_modules/kafkajs/src/protocol/error.js:581:10)
at Object.parse (/test/node_modules/kafkajs/src/protocol/requests/joinGroup/v5/response.js:35:11)
at Connection.send (/test/node_modules/kafkajs/src/network/connection.js:433:35)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Broker.[private:Broker:sendRequest] (/test/node_modules/kafkajs/src/broker/index.js:875:14)
at async Broker.joinGroup (/test/node_modules/kafkajs/src/broker/index.js:395:14)
at async ConsumerGroup.[private:ConsumerGroup:join] (/test/node_modules/kafkajs/src/consumer/consumerGroup.js:169:23)
at async /test/node_modules/kafkajs/src/consumer/consumerGroup.js:335:9
at async Runner.scheduleFetchManager (/test/node_modules/kafkajs/src/consumer/runner.js:112:11)
To Reproduce
- Run > 1 consumer as a group that subscribes to some topic and logs each topic offset
- After the consumers joined the group, remove the broker that is selected as the coordinator of the group
Expected behavior All exceptions thrown should be caught and bubbled up to the consumer interfaces.
Observed behavior Some exceptions are thrown and uncaught, causing the nodejs process to abort.
Environment:
- OS: Debian 11 (bullseye)
- KafkaJS version: 2.0.2
- Kafka version: 2.8.1
- NodeJS version: v16.15.0