I was trying to get Cassandra 0.6.8 (latest stable release) going for the first time and my attempts at getting the example code to run caused Cassandra to die with out a JavaMemoryError just by connecting cassandra-cli to cassandra.

java.lang.OutOfMemoryError: Java heap space
at org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:296) at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:203) at org.apache.cassandra.thrift.Cassandra$Processor.process(Cassandra.java:1154) at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:167) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

Looking at the thrift code it is allocating arrays based on lengths read of the wire, without adequate validation of the length. This allows client errors to crash the server :(

The steps were:

1) I was trying to use the Java sample client code in

http://wiki.apache.org/cassandra/ThriftExamples

I got past the pains of thrift install, and the fact that the sample code is out of date. Constructor signatures have changed in the code thrift r917130 (as used in 0.6.8) generates.

2) I then ran into the problem that the sample client uses framed transport, but cassandra default storage-conf.xml uses unframed transport. This didn't give a clean error, but just cause the client to block for ever :(

I changed the cassandra storage-conf.xml to use framed transport to resolve this.

3) Using the cassandra-cli to connect to cassandra produced the error above. This is presumably because the client was using unframed transport and the server wasn't. That said the server should have enough validation to avoid crashin because of bad clients.

I plan to persevere, but I thought I'd let you all know as these sort of problems could put off a lot of newcomers.

Nick Reeves


Reply via email to