Updated Branches:
  refs/heads/cassandra-1.1 e220efa2a -> 5bde2a6d5

Query the JVM for the minimum stack size.
Patch by Trevor Robinson, reviewed by brandonwilliams for CASSANDRA-4442


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5bde2a6d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5bde2a6d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5bde2a6d

Branch: refs/heads/cassandra-1.1
Commit: 5bde2a6d5d6bed3ff15ec6caf20524717a130ecb
Parents: e220efa
Author: Brandon Williams <brandonwilli...@apache.org>
Authored: Fri Jul 20 15:01:51 2012 -0500
Committer: Brandon Williams <brandonwilli...@apache.org>
Committed: Fri Jul 20 15:01:51 2012 -0500

----------------------------------------------------------------------
 conf/cassandra-env.sh |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5bde2a6d/conf/cassandra-env.sh
----------------------------------------------------------------------
diff --git a/conf/cassandra-env.sh b/conf/cassandra-env.sh
index cef0efb..17c2fb8 100644
--- a/conf/cassandra-env.sh
+++ b/conf/cassandra-env.sh
@@ -151,18 +151,19 @@ if [ "x$CASSANDRA_HEAPDUMP_DIR" != "x" ]; then
     JVM_OPTS="$JVM_OPTS 
-XX:HeapDumpPath=$CASSANDRA_HEAPDUMP_DIR/cassandra-`date +%s`-pid$$.hprof"
 fi
 
+java_version=`"${JAVA:-java}" -version 2>&1 | awk '/version/ {print $3}' | 
egrep -o '[0-9]+\.[0-9]+'`
 
 if [ "`uname`" = "Linux" ] ; then
-    java_version=`"${JAVA:-java}" -version 2>&1 | awk '/version/ {print $3}' | 
egrep -o '[0-9]+\.[0-9]+'`
+    # try to determine JVM stack minimum by using too-small stack
+    # (note that 16k causes segfault and smaller prints invalid size error)
+    java_min_stack=`"${JAVA:-java}" -Xss32k 2>&1 | sed -nr 's/The stack size 
specified is too small, Specify at least ([0-9]+k)/\1/p'`
     # reduce the per-thread stack size to minimize the impact of Thrift
     # thread-per-client.  (Best practice is for client connections to
     # be pooled anyway.) Only do so on Linux where it is known to be
     # supported.
-    if [ "$java_version" = "1.7" ]
+    if [ -n "$java_min_stack" ]
     then
-        JVM_OPTS="$JVM_OPTS -Xss160k"
-    else
-        JVM_OPTS="$JVM_OPTS -Xss128k"
+        JVM_OPTS="$JVM_OPTS -Xss$java_min_stack"
     fi
 fi
 echo "xss = $JVM_OPTS"

Reply via email to