Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumer not retrying connection when dropped #1163

Open
p-karanthaker opened this issue Aug 2, 2021 · 6 comments
Open

Consumer not retrying connection when dropped #1163

p-karanthaker opened this issue Aug 2, 2021 · 6 comments

Comments

@p-karanthaker
Copy link

p-karanthaker commented Aug 2, 2021

Describe the bug
I am running a consumer with a single broker instance. When the connection to the broker is dropped - the consumer will sometimes hang and sometimes the kafkajs code to retry and restart will kick in. It appears to be random in what happens.

To Reproduce
I've used the sample consumer code from the KafkaJS website. Uploaded what I have as a Gist below.

  1. consumer code
  2. Block port 9092 (or whatever port your broker is on) to simulate connection drop with broker:
    2.1. sudo iptables -A OUTPUT -p tcp --sport 9092 -j DROP Prevent the server from reaching the client
    2.2. sudo iptables -A INPUT -p tcp --dport 9092 -j DROP Prevent the client from reaching the server

Expected behavior
I would expect kafkajs to always go into a retry/restart loop.

Observed behavior
I observed two things:

  1. The expected behaviour happens
  2. The consumer hangs and never retries/restarts
{"level":"ERROR","timestamp":"2021-08-02T09:27:19.903Z","logger":"kafkajs","message":"[Connection] Connection error: read ETIMEDOUT","broker":"192.168.1.77:9092","clientId":"example-consumer","stack":"Error: read ETIMEDOUT\n    at TCP.onStreamRead (internal/stream_base_commons.js:209:20)"}

The two behaviours seem inconsistent and random

Environment:

  • OS: Ubuntu 20.04.2 LTS
  • KafkaJS version 1.15.0
  • Kafka version 2.7.0
  • NodeJS version v12.22.3
@fatum
Copy link

fatum commented Aug 4, 2021

We're experiencing the same thing

@Igor-Kuzmin
Copy link
Contributor

We also faced this issue.
As a workaround we enabled enforceRequestTimeout and restarting the consumer manually based on CRASH event.

@backbone87
Copy link

Can confirm this behavior.

@backbone87
Copy link

Is there any way to help to move this forward towards a resolution?

@mguay22
Copy link

mguay22 commented Aug 11, 2022

I can no longer reproduce this on v2.1.0. Can anyone confirm otherwise?

@mguay22
Copy link

mguay22 commented Aug 11, 2022

I believe this is fixed by #1337

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

No branches or pull requests

5 participants