You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Nick Reeves <nd...@realvnc.com> on 2010/11/18 17:49:19 UTC

Cassandra OutOfMemoryError

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



Re: Cassandra OutOfMemoryError

Posted by Peter Schuller <pe...@infidyne.com>.
> 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 :(

This is fixed with latest cassandra and current versions of thrift. I
don't remember whether it was a thrift bug in and of itself, or
whether it was in combination with the move to the framed thrift
transport (and I didn't find the JIRA atm).

I *think* the latest 0.6 with its version of thrift and enabling
framed mode should be sufficient to avoid it but I'm not certain about
the 0.6 branch.


-- 
/ Peter Schuller

Introduction to timestamps in Cassandra

Posted by Jérôme Verstrynge <jv...@gmail.com>.
Hi,

Following a long conversation about timestamps on this email list a 
couple of weeks ago, I have written a post to summarize the information 
that was made available. Thanks to Peter Schuller for helping clarifying 
many issues. The post is available at:

   http://adamman71.blogspot.com/2010/11/timestamps-in-cassandra.html

I am going to submit it to Hacker News. If you like it, don't hesitate 
to cast your vote (+1) by submitting the above link at:

   http://news.ycombinator.com/submit

If the Cassandra community likes it, don't hesitate to add it to 
http://wiki.apache.org/cassandra/ArticlesAndPresentations.

Cheers,

Jérôme Verstrynge



Re: Cassandra OutOfMemoryError

Posted by Jonathan Ellis <jb...@gmail.com>.
Step 0: don't use raw Thrift, use one of the clients from
http://wiki.apache.org/cassandra/ClientOptions06

On Thu, Nov 18, 2010 at 10:49 AM, Nick Reeves <nd...@realvnc.com> wrote:
> 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
>
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com