Why is Cassandra client failing without epoll in production? [duplicate]

我只是一个虾纸丫 提交于 2020-02-20 05:53:42

问题


When I run my service locally, I get a warning that epoll isn't available, so it's using NIO. Fair enough. When I deploy it in Kubernetes, I get this, which prevents the service from running:

2017-03-29T19:09:22.739482458Z 19:09:22.739 WARN  com.datastax.driver.core.NettyUtil - Found Netty's native epoll transport in the classpath, but epoll is not available. Using NIO instead. 
2017-03-29T19:09:22.739505903Z java.lang.UnsatisfiedLinkError: could not load a native library: netty-transport-native-epoll
2017-03-29T19:09:22.739509966Z  at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:224)
2017-03-29T19:09:22.739513326Z  at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:269)
2017-03-29T19:09:22.739516421Z  at io.netty.channel.epoll.Native.<clinit>(Native.java:64)
2017-03-29T19:09:22.739519628Z  at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:33)
2017-03-29T19:09:22.739522527Z  at java.lang.Class.forName0(Native Method)
2017-03-29T19:09:22.739525253Z  at java.lang.Class.forName(Class.java:264)
2017-03-29T19:09:22.739528047Z  at com.datastax.driver.core.NettyUtil.<clinit>(NettyUtil.java:68)
2017-03-29T19:09:22.739530907Z  at com.datastax.driver.core.NettyOptions.eventLoopGroup(NettyOptions.java:99)
2017-03-29T19:09:22.739533585Z  at com.datastax.driver.core.Connection$Factory.<init>(Connection.java:769)
2017-03-29T19:09:22.739544382Z  at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1400)
2017-03-29T19:09:22.739547340Z  at com.datastax.driver.core.Cluster.init(Cluster.java:159)
2017-03-29T19:09:22.739550134Z  at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:330)
2017-03-29T19:09:22.739555749Z  at com.datastax.driver.core.Cluster.connect(Cluster.java:280)
2017-03-29T19:09:22.739558846Z  at io.getquill.context.cassandra.CassandraSessionContext.<init>(CassandraSessionContext.scala:38)
2017-03-29T19:09:22.739562704Z  at io.getquill.CassandraAsyncContext.<init>(CassandraAsyncContext.scala:19)
2017-03-29T19:09:22.739565629Z  at io.xxxxxxxxx.platform.db.Datastore.<init>(Datastore.scala:26)
2017-03-29T19:09:22.739568481Z  at DatastoreModule.configure(DatastoreModule.scala:22)
2017-03-29T19:09:22.739571234Z  at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
2017-03-29T19:09:22.739574009Z  at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
2017-03-29T19:09:22.739576726Z  at com.google.inject.spi.Elements.getElements(Elements.java:110)
2017-03-29T19:09:22.739579348Z  at com.google.inject.util.Modules$OverrideModule.configure(Modules.java:177)
2017-03-29T19:09:22.739581979Z  at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
2017-03-29T19:09:22.739584688Z  at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
2017-03-29T19:09:22.739587416Z  at com.google.inject.spi.Elements.getElements(Elements.java:110)
2017-03-29T19:09:22.739590109Z  at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
2017-03-29T19:09:22.739592859Z  at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
2017-03-29T19:09:22.739595643Z  at com.google.inject.Guice.createInjector(Guice.java:99)
2017-03-29T19:09:22.739598376Z  at com.google.inject.Guice.createInjector(Guice.java:84)
2017-03-29T19:09:22.739600979Z  at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181)
2017-03-29T19:09:22.739603649Z  at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123)
2017-03-29T19:09:22.739606361Z  at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
2017-03-29T19:09:22.739609008Z  at play.core.server.ProdServerStart$.start(ProdServerStart.scala:47)
2017-03-29T19:09:22.739611618Z  at play.core.server.ProdServerStart$.main(ProdServerStart.scala:22)
2017-03-29T19:09:22.739614246Z  at play.core.server.ProdServerStart.main(ProdServerStart.scala)
2017-03-29T19:09:22.739616846Z Caused by: java.lang.RuntimeException: failed to get field ID: DefaultFileRegion.transfered
2017-03-29T19:09:22.739619540Z  at java.lang.ClassLoader$NativeLibrary.load(Native Method)
2017-03-29T19:09:22.739624975Z  at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
2017-03-29T19:09:22.739627704Z  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
2017-03-29T19:09:22.739630403Z  at java.lang.Runtime.load0(Runtime.java:809)
2017-03-29T19:09:22.739632988Z  at java.lang.System.load(System.java:1086)
2017-03-29T19:09:22.739635608Z  at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:36)
2017-03-29T19:09:22.739638288Z  at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:255)
2017-03-29T19:09:22.739640937Z  at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:222)
2017-03-29T19:09:22.739643779Z  ... 33 common frames omitted
2017-03-29T19:09:22.902948521Z 19:09:22.902 WARN  i.n.util.concurrent.DefaultPromise - An exception was thrown by com.datastax.driver.core.Connection$1.operationComplete() 
2017-03-29T19:09:22.902975391Z java.lang.NullPointerException: null
2017-03-29T19:09:22.902979455Z  at io.netty.channel.group.DefaultChannelGroup.add(DefaultChannelGroup.java:146)
2017-03-29T19:09:22.902982663Z  at io.netty.channel.group.DefaultChannelGroup.add(DefaultChannelGroup.java:42)
2017-03-29T19:09:22.902985588Z  at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:162)
2017-03-29T19:09:22.902988575Z  at com.datastax.driver.core.Connection$1.operationComplete(Connection.java:149)
2017-03-29T19:09:22.902991374Z  at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)
2017-03-29T19:09:22.902995665Z  at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:488)
2017-03-29T19:09:22.902998584Z  at io.netty.util.concurrent.DefaultPromise.access$000(DefaultPromise.java:34)
2017-03-29T19:09:22.903001524Z  at io.netty.util.concurrent.DefaultPromise$1.run(DefaultPromise.java:438)
2017-03-29T19:09:22.903004958Z  at io.netty.util.concurrent.GlobalEventExecutor$TaskRunner.run(GlobalEventExecutor.java:233)
2017-03-29T19:09:22.903008073Z  at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
2017-03-29T19:09:22.903011054Z  at java.lang.Thread.run(Thread.java:745)

How do I:

a) Stop the error; and

b) Make it use epoll if that's more performant than whatever NIO uses otherwise (is it really using select?)


回答1:


Adding this dependency fixed the problem:

"io.netty" % "netty-transport-native-epoll" % "4.1.6.Final" classifier "linux-x86_64"



来源:https://stackoverflow.com/questions/43103047/why-is-cassandra-client-failing-without-epoll-in-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!