Java Heap Space Error

Hi,

Good day!

I encountered an error below while creating a topic.

NOTE: zookeeper and kafka are SSL enabled

[rhel@kafkanode1 bin]$ /home/rhel/confluent-6.0.5/bin/kafka-topics --bootstrap-server kafkanode1.localdomain:9092 \
>   --create \
>   --topic test1 \
>   --partitions 1 \
>   --replication-factor 1
[2023-01-17 16:35:30,354] 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.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:57)
        at java.nio.ByteBuffer.allocate(ByteBuffer.java:335)
        at org.apache.kafka.common.memory.MemoryPool$1.tryAllocate(MemoryPool.java:30)
        at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:113)
        at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:447)
        at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:397)
        at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:678)
        at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:580)
        at org.apache.kafka.common.network.Selector.poll(Selector.java:485)
        at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:547)
        at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.processRequests(KafkaAdminClient.java:1293)
        at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1224)
        at java.lang.Thread.run(Thread.java:750)
Error while executing topic command : Call(callName=createTopics, deadlineMs=1673944590067, tries=1, nextAllowedTryMs=-9223372036854775709) timed out at 9223372036854775807 after 1 attempt(s)
[2023-01-17 16:35:30,360] ERROR org.apache.kafka.common.errors.TimeoutException: Call(callName=createTopics, deadlineMs=1673944590067, tries=1, nextAllowedTryMs=-9223372036854775709) timed out at 9223372036854775807 after 1 attempt(s)
Caused by: org.apache.kafka.common.errors.TimeoutException: The AdminClient thread has exited.
 (kafka.admin.TopicCommand$)

Could it actually be a memory issue? Are you running in a VM with low memory allocated? Perhaps you can give a bit more info about your environment. Just not a lot to go on with that stacktrace.

Hi, it is running on VM. Tried creating a topic before without SSL and it worked. However, upon enabling the SSL I encountered this error.

looks like a known error when ssl is not properly configured on client side
on which port does your cluster listen for ssl connections?

basically I would recommend to follow this doc:
https://docs.confluent.io/platform/current/kafka/encryption.html#encrypt-with-tls

best,
michael

1 Like