kafkajs icon indicating copy to clipboard operation
kafkajs copied to clipboard

Deleting a topic cause "This server does not host this topic-partition" error

Open eoc-ross opened this issue 3 years ago • 2 comments

Describe the bug I'm not sure if it's really an issue or a misusage by my side, but it appears that once a producer has sent a message on a topic, deleting the topic causes "This server does not host this topic-partition" error on all topic created after deletion.

To Reproduce Steps to reproduce:

  • create kafkajs instance, a producer KAFKA_PRODUCER and connect
  • create consumer with groupId = CONSUMER_1 (kafkajs.consumer) and connect
  • add topic TOPIC_1 (admin.createTopics) and subscribe CONSUMER_1
  • send at least a message with KAFKA_PRODUCER (wait for delivery)
  • disconnect CONSUMER_1
  • delete TOPIC_1 (admin.deleteTopics)
  • create CONSUMER_2, TOPIC_2 and subscribe
  • send a message using the same KAFKA_PRODUCER
  • error -> "KafkaJSProtocolError: This server does not host this topic-partition"

Expected behavior Since I disconnected CONSUMER_1, I would expect no errors from the producer.

Observed behavior It looks like the producer is still aware of the deleted topic. The weird part, is that the error makes the whole server instance unusable and I have to restart it.

Environment:

  • OS: Ubuntu 20.04.2
  • KafkaJS version: 1.16.0-beta.21
  • Kafka version: 2.6.2
  • NodeJS version: 14.15.1

Additional context Has anyone observed this behavior? Need I also to disconnect the producer after topic deletion? Any help is greatly appreciated.

Regards

eoc-ross avatar Jul 06 '21 13:07 eoc-ross

I get the same error message when I am trying to create a topic via the admin connection (tried with Azure and Aiven) which is nonsensical since the nonexistence of the topic was the pretext of creating it. Both accounts do have admin rights

KafkaJs 1.12.0

joerg-walter-de avatar Oct 28 '21 06:10 joerg-walter-de

I have connected a kafkajs (1.15.0) Service to an Aiven-Cluster. When the consumer is subscribed to topics A and empty topic B, and when I delete topic B via the Aiven portal, the kafkajs consumer crashes - and the topic is not deleted per the portal.

Not sure if this is relevant

joerg-walter-de avatar Feb 09 '22 12:02 joerg-walter-de

I get the same thing. I do an adminClient.list(), then adminClient.deleteTopics() and some topics are not deleted and I see This server does not host this topic-partition followed by There is no leader for this topic-partition as we are in the middle of a leadership election

jseparovic avatar Nov 05 '22 23:11 jseparovic