[Resolved] ERROR Uncaught exception in thread 'kafka-admin-client-thread | adminclient-1': (org.apache.kafka.common.utils.KafkaThread) java.lang.OutOfMemoryError: Java heap space

 

Issue:- 

When trying to delete the topic in the Amazon MSK kafka clusterr got the following error

Error:- 

 ERROR Uncaught exception in thread 'kafka-admin-client-thread | adminclient-1': (org.apache.kafka.common.utils.KafkaThread)
java.lang.OutOfMemoryError: Java heap space

Effect:-

Was not able to delete the Topic in the MSK kafka cluster due to the above error message.

 ERROR Uncaught exception in thread 'kafka-admin-client-thread | adminclient-1': (org.apache.kafka.common.utils.KafkaThread)
java.lang.OutOfMemoryError: Java heap space
	at java.base/java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:61)
	at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:348)
	at org.apache.kafka.common.memory.MemoryPool$1.tryAllocate(MemoryPool.java:30)
	at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:112)
	at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:424)
	at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:385)
	at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:651)
	at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:572)
	at org.apache.kafka.common.network.Selector.poll(Selector.java:483)
	at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:535)
	at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1131)

Resolution:-

Follow the following steps

1. By including the truststore in the command with --command-config and the client properties was able to resolve the above issue. 
 kubectl apply -f https://k8s.io/examples/admin/dns/dnsutils.yaml  
 

2. Now run the nslookup command on the DNS name and verify if its getting resolved or not
./kafka-topics.sh --bootstrap-server b-1.test-kafka.q15lx0.c10.kafka.us-west-2.amazonaws.com:9094,b-2.test-kafka.q15lx0.c10.kafka.us-west-2.amazonaws.com:9094,b-3.test-kafka.q15lx0.c10.kafka.us-west-2.amazonaws.com:9094 --delete --topic <topic-name>  --command-config  /Users/amittal/kafka/kafka_2.12-2.2.1/bin/client.properties

Explanation:-

You might be having the truststore in your home directory but you need to include it in your command with the --command-config otherwise it will fail to connect to the kafka cluster and eventually you wont be able to delete the topic from the Amazon Kafka cluster.

Comments

Popular posts from this blog

[Solved] Gitlab remote: ERROR: Your SSH key has expired.

[Resolved] groupVersion shouldn't be empty

[Solved] Fingerprint sha256 has already been taken