atlas icon indicating copy to clipboard operation
atlas copied to clipboard

Fixed issue with Cassandra and Netty

Open zdmytriv opened this issue 6 years ago • 2 comments

We were getting exception when starting Atlas with Cassandra support. CQLStorageManager could not be initialized and last exception looked like:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.netty.util.internal.PlatformDependent0
        at io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:694)
        at io.netty.channel.nio.NioEventLoop$4.run(NioEventLoop.java:171)
        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_91]
        at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:167)
        at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:149)
        at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:102)
        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64)
        at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49)
        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:70)
        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:65)
        at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:56)

This seems to fix this issue.

zdmytriv avatar Oct 20 '18 16:10 zdmytriv

Hi all

Thanks for this pull request.

Does this actually work?

I tried adding those codes in the pom.xml files but still got this when doing bin/atlas_start.py

2018-11-13 11:38:37,744 ERROR - [main:] ~ cassandra.jmx.local.port missing from cassandra-env.sh, unable to start local JMX service.null (CassandraDaemon:87)
2018-11-13 11:38:39,110 ERROR - [main:] ~ Exception encountered during startup (CassandraDaemon:541)
java.lang.NoSuchMethodError: io.netty.util.internal.PlatformDependent.newLongCounter()Lio/netty/util/internal/LongCounter;
	at io.netty.buffer.PoolArena.<init>(PoolArena.java:65)
	at io.netty.buffer.PoolArena$HeapArena.<init>(PoolArena.java:638)
	at io.netty.buffer.PooledByteBufAllocator.<init>(PooledByteBufAllocator.java:179)
	at io.netty.buffer.PooledByteBufAllocator.<init>(PooledByteBufAllocator.java:153)
	at io.netty.buffer.PooledByteBufAllocator.<init>(PooledByteBufAllocator.java:145)
	at io.netty.buffer.PooledByteBufAllocator.<clinit>(PooledByteBufAllocator.java:128)
	at org.apache.cassandra.transport.CBUtil.<clinit>(CBUtil.java:54)
	at org.apache.cassandra.transport.Server.run(Server.java:164)
	at org.apache.cassandra.transport.Server.start(Server.java:116)
	at org.apache.cassandra.service.CassandraDaemon.start(CassandraDaemon.java:454)
	at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:537)
	at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:613)

How should I resolve this?

Thanks! :)

devacto avatar Nov 13 '18 03:11 devacto

There seems to be three different versions of netty originally

$ git checkout release-1.1.0-rc2
$ mvn clean -DskipTests package -Pdist
$ jar -tf webapp/target/atlas-webapp-1.1.0.war | grep netty
WEB-INF/lib/netty-buffer-4.0.37.Final.jar
WEB-INF/lib/netty-handler-4.0.37.Final.jar
WEB-INF/lib/netty-3.7.0.Final.jar
WEB-INF/lib/netty-common-4.0.37.Final.jar
WEB-INF/lib/netty-transport-4.0.37.Final.jar
WEB-INF/lib/netty-codec-4.0.37.Final.jar
WEB-INF/lib/netty-all-4.0.23.Final.jar

After applying the fix in this PR, it goes down to two

$ jar -tf webapp/target/atlas-webapp-1.1.0.war | grep netty
WEB-INF/lib/netty-3.7.0.Final.jar
WEB-INF/lib/netty-all-4.0.23.Final.jar

Zookeeper seems to be pulling the 3.7.0 version. I excluded it from ./pom.xml (it becomes:

<dependency>
    <groupId>org.apache.zookeeper</groupId>
    <artifactId>zookeeper</artifactId>
    <version>${zookeeper.version}</version>
    <exclusions>
        <exclusion>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
        </exclusion>
    </exclusions>
</dependency>

)

After that, seeing only one version of netty

jar -tf webapp/target/atlas-webapp-1.1.0.war | grep netty
WEB-INF/lib/netty-all-4.0.23.Final.jar

fadimaali avatar Feb 19 '19 11:02 fadimaali