apache/cassandra · critical · RuntimeException
Out of native memory occured, You can avoid it by…
Error message
Out of native memory occured, You can avoid it by increasing the system ram space or by increasing bloom_filter_fp_chance.
What it means
OffHeapBitSet allocates its bit array off-heap via Memory.allocate; if the OS cannot supply byteCount native bytes (OutOfMemoryError), it wraps it in a RuntimeException advising more RAM or a higher bloom_filter_fp_chance. The filter size itself was legal (see the 16GB check) but physical native memory ran out.
Solutions
- Increase bloom_filter_fp_chance (ALTER TABLE ... WITH bloom_filter_fp_chance = 0.01) to shrink the allocation.
- Add system RAM or raise container/native memory limits; verify with free/OS metrics.
- Reduce concurrent compactions/flushes to lower peak native memory demand, or reduce SSTable sizes.
Example fix
// before ALTER TABLE t WITH bloom_filter_fp_chance = 0.001; // after ALTER TABLE t WITH bloom_filter_fp_chance = 0.01;
Defensive patterns
Strategy: fallback
Validate before calling
long byteCount = (((numBits - 1) >>> 6) + 1) * 8L;
if (byteCount > Runtime.getRuntime().maxMemory()) logger.warn("bloom filter needs {} bytes native memory", byteCount); Try / catch
try { new OffHeapBitSet(numBits); } catch (RuntimeException e) { /* fall back to smaller filter / higher fp chance */ } Prevention
- Size native memory to cover worst-case bloom filter allocations plus compaction overlap.
- Avoid extreme bloom_filter_fp_chance values on very large tables.
- Monitor native memory; in containers set explicit limits with headroom.
When it happens
Trigger: Constructing an OffHeapBitSet (bloom filter creation during memtable flush / compaction) when free off-heap/native memory is less than the requested byteCount.
Common situations: Very low bloom_filter_fp_chance on large tables combined with a small native memory budget or many concurrent compactions; container memory limits capping native allocations.
Related errors
- Bloom filter size is > 16GB, reduce the…
- A maximum number of tokens per node is supported
- A repair_session_space of
- A repair_session_space of
- A storage-attached index cannot be created over multiple…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/08b90fcc90a59495.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/utils/obs/OffHeapBitSet.java:54
*/
public class OffHeapBitSet implements IBitSet
{
private final Memory bytes;
public OffHeapBitSet(long numBits)
{
/** returns the number of 64 bit words it would take to hold numBits */
long wordCount = (((numBits - 1) >>> 6) + 1);
if (wordCount > Integer.MAX_VALUE)
throw new UnsupportedOperationException("Bloom filter size is > 16GB, reduce the bloom_filter_fp_chance");
try
{
long byteCount = wordCount * 8L;
bytes = Memory.allocate(byteCount);
}
catch (OutOfMemoryError e)
{
throw new RuntimeException("Out of native memory occured, You can avoid it by increasing the system ram space or by increasing bloom_filter_fp_chance.");
}
// flush/clear the existing memory.
clear();
}
private OffHeapBitSet(Memory bytes)
{
this.bytes = bytes;
}
public long capacity()
{
return bytes.size() * 8;
}
@Override
public long offHeapSize()
{View on GitHub (pinned to 88fd0f6a0e)