I upgraded my system from 13.04 to 13.10 and I could not start Cassandra anymore, getting an out of memory error, so the heap was getting full even though all I was doing at that point was start the server.
I went in and increased the maximum heap size with -Xmx1992m (the default) to -Xms2500m.
I am wondering why would it be required to do such a thing? Could it be that the memory decreased a little bit between running Linux kernel 3.5.0 and moving to kernel 3.11.0 and could that impact Cassandra? (i.e. say I "lost" 200M, now it was allocating 1992Mb instead of 2192Mb with the previous kernel, could that be??)
My concern here is that any time I upgrade I could run in a problem like this unless I force the maximum heap size to a fixed number (instead of letting the script determine the Mb to use dynamically.) Plus, I just cannot continue to increase the limit forever. My RAM is limited... (obviously.)
On startup Cassandra shows the following (broken on 3 lines to make it easier to read here):
xss = -ea -javaagent:bin/../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities
-XX:ThreadPriorityPolicy=42 -Xms1994M -Xmx2500M -Xmn400M
-XX:+HeapDumpOnOutOfMemoryError -Xss256k
Update:
Argh! It was still starting OpenVMS because the $JAVA_HOME variable that points to /usr/lib/jvm/default-java (it is defined in /etc/environment):
JAVA_HOME=/usr/lib/jvm/default-java
And somehow it was setup back to OpenVMS in there. Although I changed the /etc/alternatives/java softlink, and thus java -version in my command line was "working fine" (returning what I'd expect) the Cassandra startup script makes use of the $JAVA_HOME variable!
So I checked the list of available VMs with:
ls -l /usr/lib/jvm
lrwxrwxrwx 1 root root 24 Apr 27 2012 default-java -> java-1.7.0-openjdk-amd64
drwxr-xr-x 4 root root 4096 Feb 23 17:54 java-1.5.0-gcj-4.8-amd64
lrwxrwxrwx 1 root root 20 Sep 2 2012 java-1.6.0-openjdk-amd64 -> java-6-openjdk-amd64
lrwxrwxrwx 1 root root 20 Jul 3 2013 java-1.7.0-openjdk-amd64 -> java-7-openjdk-amd64
drwxr-xr-x 5 root root 4096 Oct 7 2012 java-6-openjdk-amd64
drwxr-xr-x 3 root root 4096 Oct 7 2012 java-6-openjdk-common
drwxr-xr-x 5 root root 4096 Sep 21 20:06 java-7-openjdk-amd64
drwxr-xr-x 8 root root 4096 Sep 18 21:18 java-7-oracle
And ran the following two commands to get Oracle to run:
sudo rm /usr/lib/jvm/default-java
sudo ln -s java-7-oracle /usr/lib/jvm/default-java
However, that did not change the fact that I still need to have a large upper limit in terms of memory.
/usr/lib/jvm/default-java/bin/javaand it looks like that would be OpenJVM. Arrrgh!