由于内存错误导致cassandra意外关闭

时间:2016-03-09 14:52:02

标签: java cassandra out-of-memory cassandra-2.0 datastax-java-driver

我正在使用cassandra 2.0.9,其中我得到一些意外关机说OutOfMemoryError,虽然小压缩运行背景我得到了这个错误。在那之前,我对墓碑有一些警告。但是我只把gc_grace设为一天。

WARN [ReadStage:95] 2016-03-09 06:10:31,548 SliceQueryFilter.java (line 225) Read 1 live and 21072 tombstoned cells in mykeyspace.user_metrics_overview (see tombstone_warn_threshold). 1 columns was requested, slices=[-], delInfo={deletedAt=-9223372036854775808, localDeletion=2147483647}
ERROR [CompactionExecutor:68695] 2016-03-09 06:10:31,550 CassandraDaemon.java (line 199) Exception in thread Thread[CompactionExecutor:68695,1,main]
java.lang.OutOfMemoryError: Direct buffer memory
        at java.nio.Bits.reserveMemory(Bits.java:658)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:306)
        at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:174)
        at sun.nio.ch.IOUtil.read(IOUtil.java:195)
        at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:149)
        at org.apache.cassandra.io.compress.CompressedRandomAccessReader.decompressChunk(CompressedRandomAccessReader.java:110)
        at org.apache.cassandra.io.compress.CompressedRandomAccessReader.reBuffer(CompressedRandomAccessReader.java:87)
        at org.apache.cassandra.io.compress.CompressedThrottledReader.reBuffer(CompressedThrottledReader.java:41)
        at org.apache.cassandra.io.util.RandomAccessReader.seek(RandomAccessReader.java:280)
        at org.apache.cassandra.io.sstable.SSTableScanner$KeyScanningIterator.computeNext(SSTableScanner.java:262)
        at org.apache.cassandra.io.sstable.SSTableScanner$KeyScanningIterator.computeNext(SSTableScanner.java:203)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at org.apache.cassandra.io.sstable.SSTableScanner.hasNext(SSTableScanner.java:183)
        at org.apache.cassandra.utils.MergeIterator$Candidate.advance(MergeIterator.java:144)
        at org.apache.cassandra.utils.MergeIterator$ManyToOne.<init>(MergeIterator.java:87)
        at org.apache.cassandra.utils.MergeIterator.get(MergeIterator.java:46)
        at org.apache.cassandra.db.compaction.CompactionIterable.iterator(CompactionIterable.java:47)
        at org.apache.cassandra.db.compaction.CompactionTask.runWith(CompactionTask.java:129)
        at org.apache.cassandra.io.util.DiskAwareRunnable.runMayThrow(DiskAwareRunnable.java:48)
        at org.apache.cassandra.utils.WrappedRunnable.run(WrappedRunnable.java:28)
        at org.apache.cassandra.db.compaction.CompactionTask.executeInternal(CompactionTask.java:60)
        at org.apache.cassandra.db.compaction.AbstractCompactionTask.execute(AbstractCompactionTask.java:59)
        at org.apache.cassandra.db.compaction.CompactionManager$BackgroundCompactionTask.run(CompactionManager.java:198)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
 INFO [StorageServiceShutdownHook] 2016-03-09 06:10:31,551 ThriftServer.java (line 141) Stop listening to thrift clients
ERROR [CompactionExecutor:68695] 2016-03-09 06:10:31,551 CassandraDaemon.java (line 199) Exception in thread Thread[CompactionExecutor:68695,1,main]
java.lang.IllegalThreadStateException
        at java.lang.Thread.start(Thread.java:705)
        at org.apache.cassandra.service.CassandraDaemon$2.uncaughtException(CassandraDaemon.java:205)
        at org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor.handleOrLog(DebuggableThreadPoolExecutor.java:220)
        at org.apache.cassandra.db.compaction.CompactionManager$CompactionExecutor.afterExecute(CompactionManager.java:973)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
 INFO [StorageServiceShutdownHook] 2016-03-09 06:10:31,590 Server.java (line 182) Stop listening for CQL clients
 INFO [StorageServiceShutdownHook] 2016-03-09 06:10:31,590 Gossiper.java (line 1279) Announcing shutdown

任何人都会帮助我。当我使用hector 1.0-5读取数据时,这个错误不会发生。但是在使用datastax java-driver core 2.0.5读取数据时,发生了此错误。这个驱动程序有什么问题吗?使用thrift和cql读取数据有什么区别吗?我的密钥空间是旧的,使用cassandra-cli创建,它的架构是

create column family user_metrics_overview
with column_type = 'Standard' 
and comparator = 'ReversedType(org.apache.cassandra.db.marshal.TimeUUIDType)' 
and default_validation_class = 'BytesType' 
and key_validation_class = 'BytesType'

1 个答案:

答案 0 :(得分:0)

运行Memory Analyzer查看内存占用量。检查heapdump以分析占用空间的原因。