[
https://issues.apache.org/jira/browse/CASSANDRA-4743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467848#comment-13467848
]
Andrey Ilinykh commented on CASSANDRA-4743:
-------------------------------------------
What is the real limit? I don't know row size in advance. Client may have a
bug. In my opinion, server should tolerate any client. Only one request should
be rejected. The fix is very simple, just compare total size to thrift message
limit.
> Range slice query causes OOM
> -----------------------------
>
> Key: CASSANDRA-4743
> URL: https://issues.apache.org/jira/browse/CASSANDRA-4743
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.1.5
> Reporter: Andrey Ilinykh
>
> I got OOM error. The log is
> ERROR [ReadStage:42] 2012-09-30 07:54:55,069 AbstractCassandraDaemon.java
> (line 135) Exception in thread Thread[ReadStage:42,5,main]
> java.lang.OutOfMemoryError: Java heap space
> at
> org.apache.cassandra.io.util.FastByteArrayOutputStream.<init>(FastByteArrayOutputStream.java:76)
> at
> org.apache.cassandra.io.util.DataOutputBuffer.<init>(DataOutputBuffer.java:40)
> at
> org.apache.cassandra.db.RangeSliceReply.getReply(RangeSliceReply.java:48)
> at
> org.apache.cassandra.service.RangeSliceVerbHandler.doVerb(RangeSliceVerbHandler.java:64)
> at
> org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:59)
> 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)
> The RangeSliceReply#getReply()
> method gets all rows, calculates total size and then try to allocate output
> buffer. There is no check done on total size, it could be very large.
> public Message getReply(Message originalMessage) throws IOException
> {
> int size = DBConstants.intSize;
> for (Row row : rows)
> size += Row.serializer().serializedSize(row,
> originalMessage.getVersion());
> DataOutputBuffer buffer = new DataOutputBuffer(size);
> buffer.writeInt(rows.size());
> for (Row row : rows)
> Row.serializer().serialize(row, buffer,
> originalMessage.getVersion());
> assert buffer.getLength() == buffer.getData().length;
> return originalMessage.getReply(FBUtilities.getBroadcastAddress(),
> buffer.getData(), originalMessage.getVersion());
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira