murks
murks

Reputation: 309

How to prevent Cassandra 2.0.11 from running out of memory on startup?

I am trying to set up a single node cassandra-instance for test purpose with the following configs:

rpc_address: 10.0.2.108
listen_address: 10.0.2.108
endpoint_snitch: SimpleSnitch

seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring.  You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
  parameters:
      # seeds is actually a comma-delimited list of addresses.
      # Ex: "<ip1>,<ip2>,<ip3>"
      - seeds: 10.0.2.108

I already changed the config in several ways but I always get an OutOfMemoryException:

INFO [main] 2014-11-09 13:00:10,808 TDisruptorServer.java (line 209) Going to use org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor@173b9122[Running, pool size = 16, active threads = 0, queued tasks = 0, completed tasks = 0] for all of the Selector threads.. ERROR [main] 2014-11-09 13:00:11,000 CassandraDaemon.java (line 513) Exception encountered during startup
java.lang.OutOfMemoryError: Java heap space
    at com.thinkaurelius.thrift.TDisruptorServer$SelectorThread.<init>(TDisruptorServer.java:543)
    at com.thinkaurelius.thrift.TDisruptorServer.<init>(TDisruptorServer.java:228)
    at org.apache.cassandra.thrift.THsHaDisruptorServer.<init>(THsHaDisruptorServer.java:51)
    at org.apache.cassandra.thrift.THsHaDisruptorServer$Factory.buildTServer(THsHaDisruptorServer.java:105)
    at org.apache.cassandra.thrift.TServerCustomFactory.buildTServer(TServerCustomFactory.java:56)
    at org.apache.cassandra.thrift.ThriftServer$ThriftServerThread.<init>(ThriftServer.java:130)
    at org.apache.cassandra.thrift.ThriftServer.start(ThriftServer.java:56)
    at org.apache.cassandra.service.CassandraDaemon.start(CassandraDaemon.java:449)
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:509)
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:585)
INFO [StorageServiceShutdownHook] 2014-11-09 13:00:11,055 Server.java (line 182) Stop listening for CQL clients
INFO [StorageServiceShutdownHook] 2014-11-09 13:00:11,056 Gossiper.java (line 1307) Announcing shutdown
INFO [StorageServiceShutdownHook] 2014-11-09 13:00:13,057 MessagingService.java (line 701) Waiting for messaging service to quiesce
INFO [ACCEPT-/10.0.2.108] 2014-11-09 13:00:13,058 MessagingService.java (line 941) MessagingService has terminated the accept() thread    

The machines total memory is 4 GB.

Upvotes: 2

Views: 2146

Answers (1)

mikea
mikea

Reputation: 6667

This is a bug addressed by https://issues.apache.org/jira/browse/CASSANDRA-8116. It can be fixed in 2.0.11 by setting the rpc_max_threads setting to a value other than the default value of Integer.MAX_VALUE.

The HsHA server was changed and now uses the rpc_max_threads values to allocate handlers per selector thread. Hence the OOM when it tries to allocate Integer.MAX_VALUE handlers

Upvotes: 3

Related Questions