The group is rebalancing, re-joining","groupId":"INSB":"my-app"error":"The group is rebalancing, so a rejoin is needed

260 views Asked by At
{"level":"ERROR","timestamp":"2023-11-21T03:53:49.952Z","logger":"kafkajs","message":"[Connection] Response Heartbeat(key: 12, version: 3)","broker":"localhost:9098","clientId":"my-app","error":"The group is rebalancing, so a rejoin is needed","correlationId":18604,"size":10}
{"level":"WARN","timestamp":"2023-11-21T03:53:51.719Z","logger":"kafkajs","message":"[Runner] The group is rebalancing, re-joining","groupId":"INSB_BNF_ATM_MIN1_CALL","memberId":"my-app-c19fa855-2dbb-443d-a3c8-50fcfff9534e","error":"The group is rebalancing, so a rejoin is needed"}
{"level":"ERROR","timestamp":"2023-11-21T04:03:52.295Z","logger":"kafkajs","message":"[Connection] Connection error: write after end","broker":"localhost:9094","clientId":"my-app","stack":"Error [ERR_STREAM_WRITE_AFTER_END]: write after end\n    at Socket.Writable.write (internal/streams/writable.js:292:11)\n    at Object.sendRequest (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/connection.js:409:27)\n    at SocketRequest.send [as sendRequest] (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/requestQueue/index.js:134:23)\n    at SocketRequest.send (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/requestQueue/socketRequest.js:88:10)\n    at RequestQueue.sendSocketRequest (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/requestQueue/index.js:182:19)\n    at RequestQueue.push (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/requestQueue/index.js:162:12)\n    at /root/mfscp_strategy_server/node_modules/kafkajs/src/network/connection.js:404:29\n    at new Promise (<anonymous>)\n    at sendRequest (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/connection.js:399:14)\n    at async Connection.send (/root/mfscp_strategy_server/node_modules/kafkajs/src/network/connection.js:418:53)"}
{"level":"ERROR","timestamp":"2023-11-21T06:19:03.219Z","logger":"kafkajs","message":"[Connection] Response Heartbeat(key: 12, version: 3)","broker":"localhost:9098","clientId":"my-app","error":"The group is rebalancing, so a rejoin is needed","correlationId":16,"size":10}
{"level":"ERROR","timestamp":"2023-11-21T06:19:03.253Z","logger":"kafkajs","message":"[Connection] Response Heartbeat(key: 12, version: 3)","broker":"localhost:9098","clientId":"my-app","error":"The group is rebalancing, so a rejoin is needed","correlationId":17,"size":10}
{"level":"WARN","timestamp":"2023-11-21T06:19:03.314Z","logger":"kafkajs","message":"[Runner] The group is rebalancing, re-joining","groupId":"INSB_BNF_ATM_MIN1_CALL","memberId":"my-app-ad3717ae-8e15-46d9-ad7c-dc821c0aa0f4","error":"The group is rebalancing, so a rejoin is needed"}
1

There are 1 answers

0
Victor On BEST ANSWER

Whatever you are doing in your JS code, it's taking too much time.

Rebalancing happens when the Kafka Client does not send the heartbeat message in session timeout. Rebalancing is bad, you should avoid. To avoid it, you have two options:

  1. Improve your code logic to be fast
  2. Increase your session timeout session.timeout.ms