Open j-a-h-i-r opened 3 years ago
I was facing similar issues while load testing, did you try producing in batch? It has helped me to avoid producing it multiple times.
@sp-suresh yes, I tried producing in batch. Still faced the same issue :( Are you using OAUTHBEARER too?
No, I am not using OAUTHBEARER. Also, worth mentioning that connectionTimeout: 4000
and authenticationTimeout: 4000
has been a relief too.
https://github.com/tulios/kafkajs/issues/554#issuecomment-568168042
Thanks for the info. I went through that issue multiple times and tried different configs without any success. I'll try again with your suggestions to see if the situation improves.
I have exactly the same issue when trying to push data coming from websocket to kafka cluster.
imeout while acquiring lock (712 waiting locks): "updating target topics" {"name":"KafkaJSNumberOfRetriesExceeded","retriable":false,"originalError":{"name":"KafkaJSLockTimeout","retriable":false},"retryCount":0,"retryTime":281,"stack":"KafkaJSNonRetriableError\n Caused by: KafkaJSLockTimeout: Timeout while acquiring lock (712 waiting locks): \"updating target topics\"\n at Timeout._onTimeout (F:\Environement\git-repo\crypto-feeds-api\node_modules\kafkajs\src\utils\lock.js:48:23)\n at listOnTimeout (internal/timers.js:549:17)\n at processTimers (internal/timers.js:492:7)"}
@j-a-h-i-r do you have updates for this issue?
@safonovklim Unfortunately no. I moved on to other tasks and haven't revisited this one. Are you also using SASL/OAUTHBEARER?
Regarding the timeout issue @kzay reported above, like: KafkaJSLockTimeout: Timeout while acquiring lock (2162 waiting locks): "updating target topics"
It looks like this specific lock timeout error is coming from the 'mutatingTargetTopics' lock in 'cluster' module. Each message publish takes and releases this lock before the actual publish. And with a high publish parallelism, too many pending contexts cause the lock to be slower (~few thousands). Increasing the requestTimeout can avoid these errors, but the lock is not really needed, at least for 99% of the calls. Here is a PR that can avoid the lock when possible: https://github.com/tulios/kafkajs/pull/1185
Any update on this? We're also running into the same java.lang.IllegalStateException: Unexpected ApiVersions request received during SASL authentication state HANDSHAKE_REQUEST
every 60 seconds on all brokers
May I ask if this issue has been resolved? I tried adding the timeout attribute in producer.send, but it didn't solve the problem
This issue is extremely close to the https://github.com/tulios/kafkajs/issues/554. The difference is that I am using
SASL/OAUTHBEARER
for authentication.Some background I am watching a directory using chokidar. When a new file arrives in the directory, it is immediately sent to Kafka. I am currently stress testing my Kafka setup. For this, I am copying some (~1000) files to the directory using a bash script. Unfortunately, this is causing errors and only a fraction of files (200-400) are ending up in Kafka.
Errors faced Below is the list of errors being thrown from KafkaJS. I have tried to add as many errors as possible. I have formatted the errors for brevity.
I have logged when the oauthBearerProvider gets called for refreshing the token. Ideally, it should be run every 50 seconds. But from the log, I saw that sometimes it was being called simultaneously,
Besides, I have noticed the following errors on the Kafka broker log,
I think the error is happening because KafkaJS is trying to produce value during the re-authentication of the OAuth token. I have no idea how I can fix this.
For comparison, I tried the same thing with the Java client and it can send thousands of messages to the same Kafka broker without any issues.
For example, here is the debug log printed by the Java producer during re-authentication,
Notice the last message. A similar flow happens with KafkaJS too. But the broker somehow throws the previously mentioned error
Kafka Setup
I am running Kafka in docker using the
confluentinc/cp-kafka:5.5.0
image. My sample broker setup is below,Producer code
To Reproduce Call the
sendDataToTopic
method in a loop (~1000 iterations)Expected behavior All the messages are sent to Kafka and connection reauthentication happens automatically.
Environment:
confluentinc/cp-kafka:5.5.0
image in docker)]