3

Cassandra is failing to start if /tmp is set as noexec, which is pretty much default these days:

java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
        at org.apache.cassandra.utils.memory.MemoryUtil.allocate(MemoryUtil.java:82) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.util.Memory.<init>(Memory.java:74) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.util.Memory.allocate(Memory.java:97) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.IndexSummary$IndexSummarySerializer.deserialize(IndexSummary.java:323) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.format.SSTableReader.loadSummary(SSTableReader.java:836) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.format.SSTableReader.load(SSTableReader.java:692) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.format.SSTableReader.load(SSTableReader.java:664) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.format.SSTableReader.open(SSTableReader.java:458) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.format.SSTableReader.open(SSTableReader.java:363) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at org.apache.cassandra.io.sstable.format.SSTableReader$4.run(SSTableReader.java:501) ~[apache-cassandra-2.2.2.jar:2.2.2]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_102]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_102]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_102]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_102]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]

If I remove the noexec flag from the /var/tmp mount Cassandra starts up properly. I've tried a number of methods to change the location of the tmpdir in the cassandra-env.sh file:

JVM_OPTS="$JVM_OPTS -Djna.tmpdir=/home/cassandra/tmp"
JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=/home/cassandra/tmp"
JVM_OPTS="$JVM_OPTS -Dorg.xerial.snappy.tempdir=/home/cassandra/tmp"

I haven't used these all at once, of course, these are solutions I've found on the internet, but none seem to work. I even tried exporting TMPDIR at the start of the cassandra-env.sh file, but to no avail. It always fails with the same message.

I think it's a bad idea to leave /tmp without the noexec flag, security-wise. I'm obviously missing something basic here. How do I set the tmpdir to be /home/cassandra/tmp or something similar?

3

Ah, looks like both options have to be present in the cassandra-env.sh file:

JVM_OPTS="$JVM_OPTS -Djna.tmpdir=/home/cassandra/tmp"
JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=/home/cassandra/tmp"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.