Error sending fetch request (sessionId=INVALID, epoch=INITIAL) to node 0

created at 05-29-2022 views: 89

background

Use kafka Java Client to consume messages in kafka, but no messages are consumed, and the following information is printed in the log

Error sending fetch request (sessionId=INVALID, epoch=INITIAL) to node 0: {}.

solution

The premise of solving the problem is that the running state of the kafka cluster is normal, and the network between kafka and consumers is smooth

Add the following configuration

properties.setProperty("session.timeout.ms","600000");
properties.setProperty("request.timeout.ms","600000");

problem solving ideas

First of all, you must learn to check the official website, the official website is credible

The expected time between heartbeats to the group coordinator when using Kafka's group management facilities. Heartbeats are used to ensure that the worker's session stays active and to facilitate rebalancing when new members join or leave the group. The value must be set lower than session.timeout.ms, but typically should be set no higher than 1/3 of that value. It can be adjusted even lower to control the expected time for normal rebalances.

Type: int
Default: 3000 (3 seconds)
Valid Values:
Importance: high

The default is that a timeout will be reported in 45 seconds. I adjusted this configuration to 10 minutes.

request.timeout

The default is 30 seconds timeout, I adjusted it to 30 minutes

created at:05-29-2022
edited at: 05-29-2022: