Friday, October 09, 2009 Not enough space

Seen that?
Caused by: error=12, Not enough space
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(
at java.lang.ProcessImpl.start(
at java.lang.ProcessBuilder.start(

Yes, I hate this too. First of all, that's not what you think. It means not enough swap, because your Java suddenly wants lots of GB of memory. When Java launches fork, it starts a new VM as a fork from current process. Thus for a short period between fork and exec, there is two instances of your stuff. That's temporary though. Exactly at this moment your system cries for a lack of swap.

Now, how to cure this on Solaris as long as you're using old UFS. Simply add some space as a file to a swap:
mkfile 500m /opt/var/my.swap
swap -a /opt/var/my.swap
Uhm, OK. That's old way... But that won't work on ZFS as this file system can not use files for a swap. :-) To use this with ZFS, make another ZFS filesystem in your rpool. That's how I am using in my OpenSolaris global zone:
zfs create -V 2G rpool/additionalswap
swap -a /dev/zvol/dsk/rpool/additionalswap
To see the result, issue swap -l command and it will show you that new FS has been added to your swap, something like this:

swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 182,1 8 2095096 1823456
/dev/zvol/dsk/rpool/additionalswap 182,3 8 4194288 4194288

Now you're safe. :-)

No comments: