Repository: cassandra Updated Branches: refs/heads/cassandra-3.8 [created] c31701f60
special case for Netty's OOM during response buffer allocation Patch by snazy; reviewed by tjake for CASSANDRA-12034 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c31701f6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c31701f6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c31701f6 Branch: refs/heads/cassandra-3.8 Commit: c31701f60660b34d82ff5b6bec2db871317bd3b5 Parents: d9a4c78 Author: Robert Stupp <[email protected]> Authored: Sun Jun 19 17:30:51 2016 +0200 Committer: T Jake Luciani <[email protected]> Committed: Tue Jun 28 11:37:44 2016 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + NEWS.txt | 4 +++ conf/cassandra-env.ps1 | 9 ------- conf/cassandra-env.sh | 9 ------- conf/jvm.options | 28 ++++++++++++++++++++ .../org/apache/cassandra/transport/Message.java | 4 +++ 6 files changed, 37 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/c31701f6/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 12a6ddb..3bd691a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.8 + * Upgrade netty to 4.0.37 (CASSANDRA-12032, CASSANDRA-12034) * Improve details in compaction log message (CASSANDRA-12080) * Allow unset values in CQLSSTableWriter (CASSANDRA-11911) * Chunk cache to request compressor-compatible buffers if pool space is exhausted (CASSANDRA-11993) http://git-wip-us.apache.org/repos/asf/cassandra/blob/c31701f6/NEWS.txt ---------------------------------------------------------------------- diff --git a/NEWS.txt b/NEWS.txt index 7418f3a..7797d9e 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -19,6 +19,10 @@ using the provided 'sstableupgrade' tool. New features ------------ + - Direct memory used for native-protocol network I/O is no longer + managed by the JVM. Instead, Netty allows three options to + manage it via the system property io.netty.maxDirectMemory. + See conf/jvm.options for more information. - Shared pool threads are now named according to the stage they are executing tasks for. Thread names mentioned in traced queries change accordingly. - A new option has been added to cassandra-stress "-rate fixed={number}/s" http://git-wip-us.apache.org/repos/asf/cassandra/blob/c31701f6/conf/cassandra-env.ps1 ---------------------------------------------------------------------- diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1 index 8c4311c..9373ba6 100644 --- a/conf/cassandra-env.ps1 +++ b/conf/cassandra-env.ps1 @@ -350,15 +350,6 @@ Function SetCassandraEnvironment #$env:HEAP_NEWSIZE="800M" CalculateHeapSizes - # Direct memory used for native-protocol network I/O is no longer - # managed by the JVM. Instead, Netty allows three options to - # manage it via the system property io.netty.maxDirectMemory: - # == 0 behavior as before, uses JVM to manage direct memory (slowest). - # < 0 manages direct memory directly, max direct memory as -XX:MaxDirectMemorySize. - # > 0 manages direct memory directly, max direct memory as specified. - # Note, that appreviations like 2g or 500m are NOT accepted. - #$env:JVM_OPTS="$env:JVM_OPTS -Dio.netty.maxDirectMemory=2147483648" - ParseJVMInfo # We only set -Xms and -Xmx if they were not defined on jvm.options file http://git-wip-us.apache.org/repos/asf/cassandra/blob/c31701f6/conf/cassandra-env.sh ---------------------------------------------------------------------- diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh index 6d5de21..93434c9 100644 --- a/conf/cassandra-env.sh +++ b/conf/cassandra-env.sh @@ -167,15 +167,6 @@ USING_G1=$? # Set this to control the amount of arenas per-thread in glibc #export MALLOC_ARENA_MAX=4 -# Direct memory used for native-protocol network I/O is no longer -# managed by the JVM. Instead, Netty allows three options to -# manage it via the system property io.netty.maxDirectMemory: -# == 0 behavior as before, uses JVM to manage direct memory (slowest). -# < 0 manages direct memory directly, max direct memory as -XX:MaxDirectMemorySize. -# > 0 manages direct memory directly, max direct memory as specified. -# Note, that appreviations like 2g or 500m are NOT accepted. -#export JVM_OPTS="$JVM_OPTS -Dio.netty.maxDirectMemory=2147483648" - # only calculate the size if it's not set manually if [ "x$MAX_HEAP_SIZE" = "x" ] && [ "x$HEAP_NEWSIZE" = "x" -o $USING_G1 -eq 0 ]; then calculate_heap_sizes http://git-wip-us.apache.org/repos/asf/cassandra/blob/c31701f6/conf/jvm.options ---------------------------------------------------------------------- diff --git a/conf/jvm.options b/conf/jvm.options index 692d06b..d82fff9 100644 --- a/conf/jvm.options +++ b/conf/jvm.options @@ -140,6 +140,34 @@ #-XX:+UnlockDiagnosticVMOptions #-XX:+LogCompilation +############################ +# OFF HEAP MEMORY SETTINGS # +############################ + +# Direct memory used for native-protocol network I/O is no longer +# managed by the JVM. Instead, Netty allows three options to +# manage it via the system property io.netty.maxDirectMemory: +# == 0 behavior as before, uses JVM to manage direct memory (slowest). +# < 0 manages direct memory directly, max direct memory as -XX:MaxDirectMemorySize. +# > 0 manages direct memory directly, max direct memory as specified. +# Note, that appreviations like 2g or 500m are NOT accepted. +#-Dio.netty.maxDirectMemory=2147483648 + +# The maximum amount of direct memory the VM is allowed to allocate. +# +# Please note, that the default for this setting is neither unbounded nor 64MB. +# In fact, if -XX:MaxDirectMemorySize is omitted (or set to '-1'), +# it will be the same as the max amount of heap (Runtime.getRuntime.maxMemory()). +# Otherwise, it will used the given value in bytes. +# +# The value for this must be sufficient for off-heap memtable +# and caches. +# +# Exceptions (off-heap memory on top of this setting): +# - Netty I/O buffers (see system property io.netty.maxDirectMemory above) +# - Memory used by the row cache using OHCProvider +#-XX:MaxDirectMemorySize= + ################# # HEAP SETTINGS # ################# http://git-wip-us.apache.org/repos/asf/cassandra/blob/c31701f6/src/java/org/apache/cassandra/transport/Message.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/transport/Message.java b/src/java/org/apache/cassandra/transport/Message.java index 01a0794..c00236c 100644 --- a/src/java/org/apache/cassandra/transport/Message.java +++ b/src/java/org/apache/cassandra/transport/Message.java @@ -304,6 +304,7 @@ public abstract class Message } catch (Throwable ex) { + JVMStabilityInspector.inspectThrowable(ex); frame.release(); // Remember the streamId throw ErrorMessage.wrap(ex, frame.header.streamId); @@ -346,7 +347,9 @@ public abstract class Message throw new ProtocolException("Must not send frame with CUSTOM_PAYLOAD flag for native protocol version < 4"); messageSize += CBUtil.sizeOfBytesMap(customPayload); } + body = CBUtil.allocator.buffer(messageSize); + if (tracingId != null) { CBUtil.writeUUID(tracingId, body); @@ -393,6 +396,7 @@ public abstract class Message } catch (Throwable e) { + JVMStabilityInspector.inspectThrowable(e); throw ErrorMessage.wrap(e, message.getStreamId()); } }
