Search code examples
dockerakkaakka-clusteralpine-linuxlmdb

Akka 2.5 Distributed Data on Docker + Alpine Linux


After upgrading a service that uses Akka + Akka cluster sharding to the newly released Akka (2.5.0), we started encountering issues starting the system in Docker + Alpine Linux. From what I can infer, Akka Cluster sharding is configured to used Akka Distributed Data (which is not experimental anymore as of 2.5.0) and it is using LMDB (which requires GCC + glibc and it is not available in Alpine Linux).

My questions are as follows:

1) Is there any standard alternative supported by Akka instead of LMDB?

2) Is there any way to get LMDB to work in Alpine Linux?

Stack Trace:

[ERROR] [04/20/2017 13:42:19.014] [lotus-akka.actor.default-dispatcher-5] [akka://lotus/system/sharding/replicator/durableStore] Error relocating /tmp/lmdbjava-native-library-5972006786989102785.so: __fprintf_chk: symbol not found
akka.actor.ActorInitializationException: akka://lotus/system/sharding/replicator/durableStore: exception during creation
       at akka.actor.ActorInitializationException$.apply(Actor.scala:191)
       at akka.actor.ActorCell.create(ActorCell.scala:600)
       at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:454)
       at akka.actor.ActorCell.systemInvoke(ActorCell.scala:476)
       at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:282)
       at akka.dispatch.Mailbox.run(Mailbox.scala:223)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
       at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
       at akka.util.Reflect$.instantiate(Reflect.scala:65)
       at akka.actor.ArgsReflectConstructor.produce(IndirectActorProducer.scala:96)
       at akka.actor.Props.newActor(Props.scala:213)
       at akka.actor.ActorCell.newActor(ActorCell.scala:555)
       at akka.actor.ActorCell.create(ActorCell.scala:581)
       ... 7 more
Caused by: java.lang.UnsatisfiedLinkError: Error relocating /tmp/lmdbjava-native-library-5972006786989102785.so: __fprintf_chk: symbol not found
       at jnr.ffi.provider.jffi.NativeLibrary.loadNativeLibraries(NativeLibrary.java:87)
       at jnr.ffi.provider.jffi.NativeLibrary.getNativeLibraries(NativeLibrary.java:70)
       at jnr.ffi.provider.jffi.NativeLibrary.getSymbolAddress(NativeLibrary.java:49)
       at jnr.ffi.provider.jffi.NativeLibrary.findSymbolAddress(NativeLibrary.java:59)
       at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:158)
       at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:89)
       at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:43)
       at jnr.ffi.LibraryLoader.load(LibraryLoader.java:325)
       at jnr.ffi.LibraryLoader.load(LibraryLoader.java:304)
       at org.lmdbjava.Library.<clinit>(Library.java:95)
       at org.lmdbjava.Env$Builder.open(Env.java:406)
       at org.lmdbjava.Env$Builder.open(Env.java:430)
       at akka.cluster.ddata.LmdbDurableStore.<init>(DurableStore.scala:131)
       ... 16 more

Solution

  • Finally managed to solve this problem. Cluster sharding attempts to use durable storage by default (default is LMDB). For cluster sharding without using remember-entities, durable storage is not required.

    Hence, the solution to this was to disable durable storage for cluster sharding by adding the following configuration

    akka.cluster.sharding.distributed-data.durable.keys = []