OutOfMemoryError: Direct Buffer Memory

Running a Spring Boot application we have attempted our best to profile the root cause of this. We’ve attempted setting MaxDirectMemorySize explicitly. With plenty of heap and non-heap memory available we observed that java.nio.BufferPool.direct continues to fill up over time until eventually crashing.

My question is besides how to fix this problem, how/where is the buffer cleared?

We’re not able to extract a good heap dump (a separate thread was started on this matter) therefore we can’t gather more information.

Hi Michael,

Axon itself doesn’t use any BufferPool.direct(). The AxonServerConnector does use Netty, which in turns uses direct memory buffers for its communication. But it may also be Tomcat/Netty which is embedded inside Spring Boot that is misbehaving.

Do you use AxonServer?

We do not. Our message consumption is entirely through Kafka.
I was able to dig deeper into this issue and at the moment increased the size of direct memory buffer on the jvm. Currently believe that it’s due to the size of messages (although after doing the math in bytes things didn’t quite add up).

I have a new concern with regard to OOME which I believe deserves it’s own conversation thread. This time with regard to heap memory. I started the thread here: https://groups.google.com/forum/#!topic/axonframework/XnJtTtcAlTs