April 17, 2013

Java Memory in open VZ machines

Hi,

I ran into troubles while trying to run a play application. The server is hosted in an openVZ container, which lead to problems during jvm memory initialization when I entered à play start command :

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

After googling a while, this SO thread gave me the answer which I'll summarize here.

If you're in a hurry, here is the answer : edit the [JRE location]/lib/[Archi (ex : i386)]/jvm.cfg file and alter the first uncommented line.

Move from


-client IF_SERVER_CLASS -server
-server KNOWN
-hotspot ALIASED_TO -client
-classic WARN
-native ERROR
-green ERROR

to:
#-client IF_SERVER_CLASS -server
-client KNOWN
-server KNOWN
-hotspot ALIASED_TO -client
-classic WARN
-native ERROR
-green ERROR

From what I understand, with the initial configuration, when trying to launch a java process if the machine has 2G+ memory installed  it fires up the JVM in server mode.
Server mode means the JVM will ask for all the memory requested in contiguous memory blocks, and openVZ is not able to do that.

The -client KNOWN option will ask for memory on the fly, thus removing the problem meentionned above.

Hope this help.


April 09, 2013

Yeoman : TypeError('Arguments to path.join must be strings');

Edit : Node 0.10 is now fully supported (working with a 0.10.17 right now) - keeping the old thread for archive. However, I had the error described below with the default Ubuntu 12.04 LTS node version (0.11-pre something) 


Hi all,

Today I was playing with this great Yeoman tool. Basically it's a scaffolding tool (yo) combined with a building (grunt) and dependency manager tool (bower) for building front end apps.



That tool (or that tooling set) is really, really great and you should check it out.

Set up is really easy, everything is packaged as Node.js modules. Only thing I didn't see first when installing the stack : Node.js is fully supported until version 0.8.x for now. Running a higher version (0.10 in my case) will lead to problems like this

path.js:360
        throw new TypeError('Arguments to path.join must be strings');
              ^
TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Object. (/opt/nodejs/node-v0.10.0-linux-x64/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/bower/lib/core/config.js:41:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)


This error doesn't come right away, I had it when trying to use the angular generator (angular:route) to be precise.

Hope this help.