Akka 2.0.4: OutOfMemoryError: Direct buffer memory

264 views
Skip to first unread message

Evan Chan

unread,
Sep 17, 2013, 1:00:34 PM9/17/13
to akka...@googlegroups.com
Hey guys,

I have an app that will create and stop ActorSystems many times during the lifetime of the app.  It is currently using Akka 2.0.4.   After about 20 or 30 cycles of actor system creation and stoppage, we start getting these errors when creating a new ActorSystem:

Uncaught error from thread [JobServer-akka.actor.default-dispatcher-6774] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[JobServer]
java.lang.OutOfMemoryError: Direct buffer memory
        at java.nio.Bits.reserveMemory(Bits.java:632)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:97)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
        at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$Preallocation.<init>(SocketSendBufferPool.java:158)
        at org.jboss.netty.channel.socket.nio.SocketSendBufferPool.<init>(SocketSendBufferPool.java:40)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.<init>(AbstractNioWorker.java:123)
        at org.jboss.netty.channel.socket.nio.NioWorker.<init>(NioWorker.java:49)
        at org.jboss.netty.channel.socket.nio.NioWorkerPool.createWorker(NioWorkerPool.java:42)
        at org.jboss.netty.channel.socket.nio.NioWorkerPool.createWorker(NioWorkerPool.java:26)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool.createWorker(AbstractNioWorkerPool.java:98)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool.<init>(AbstractNioWorkerPool.java:60)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool.<init>(AbstractNioWorkerPool.java:74)
        at org.jboss.netty.channel.socket.nio.NioWorkerPool.<init>(NioWorkerPool.java:37)
        at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.<init>(NioServerSocketChannelFactory.java:131)
        at akka.remote.netty.NettyRemoteServer.<init>(Server.scala:30)
        at akka.remote.netty.NettyRemoteTransport.liftedTree1$1(NettyRemoteSupport.scala:72)
        at akka.remote.netty.NettyRemoteTransport.<init>(NettyRemoteSupport.scala:72)
        at sun.reflect.GeneratedConstructorAccessor18.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3$$anonfun$apply$1.apply(DynamicAccess.scala:108)
        at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3$$anonfun$apply$1.apply(DynamicAccess.scala:105)
        at akka.actor.DynamicAccess$class.withErrorHandling(DynamicAccess.scala:72)
        at akka.actor.ReflectiveDynamicAccess.withErrorHandling(DynamicAccess.scala:90)
        at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:105)
        at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:102)
        at scala.Either.fold(Either.scala:96)
        at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:102)
        at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:85)
        at akka.actor.ActorSystemImpl._start(ActorSystem.scala:588)
        at akka.actor.ActorSystemImpl.start(ActorSystem.scala:595)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:111)
        at akka.actor.ActorSystem$.apply(ActorSystem.scala:104)
        at spark.util.AkkaUtils$.createActorSystem(AkkaUtils.scala:64)

I looked in the history and didn't see any other Direct Buffer memory errors resulting from creation of ActorSystems.  Any ideas?
I could try 2.0.5 but I looked at the release notes and didn't see any changes related to this, so I'm doubtful that this error would be cleared.

-Evan

√iktor Ҡlang

unread,
Sep 17, 2013, 1:39:48 PM9/17/13
to Akka User List
Update Netty?


--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--
Viktor Klang
Director of Engineering

Twitter: @viktorklang

Evan Chan

unread,
Sep 17, 2013, 2:44:53 PM9/17/13
to akka...@googlegroups.com
Hi Victor,

Akka 2.0.4 comes with Netty 3.5.6, should I use a newer version of Netty than comes with Akka?


You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/LR2FarlGsGE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
Evan Chan
Staff Engineer
e...@ooyala.com  | 


√iktor Ҡlang

unread,
Sep 17, 2013, 3:20:33 PM9/17/13
to Akka User List

Since it is Netty who is allocating things and potentially leaking memory, you might want to check if there's been any fixes in Netty for the 3.5 series.

Evan Chan

unread,
Sep 18, 2013, 4:04:14 PM9/18/13
to akka...@googlegroups.com
Viktor,

Thanks, it seems that upgrading Netty has addressed that error.

-Evan

√iktor Ҡlang

unread,
Sep 18, 2013, 4:43:23 PM9/18/13
to Akka User List
Akka rocks

Cheers,
Reply all
Reply to author
Forward
0 new messages