joyent/node — Issue #2830: node hangs up on SmartOS with -O(>1) 
Author: shigeki
Created: 2012-02-26 18:45:40+00:00
State: open

The node of Release build which is compiled with -O3 on SmartOS hangs up by the following script.

````
[node@ohtsu /var/tmp/node]$ cat ./test.js
var obj = {f: function(){}};
console.log(obj);
[node@ohtsu /var/tmp/node]$ ./node_O3 -v
v0.7.6-pre
[node@ohtsu /var/tmp/node]$ ./node_O3 ./test.js
^C[node@ohtsu /var/tmp/node]$
````
Note that node_O3 is the binary compiled with -O3 as defined by 'cflags': [ '-O3', '-fdata-sections', '-ffunction-sections' ] in common.gypi

I tried to test it on two types of kernels below but the issue still exists in both.
````
Server on no.de
$ uname -a
SunOS ohtsu.no.de 5.11 joyent_20110802T190624Z i86pc i386 i86pc Solaris
Server on node-ninja.com
$ uname -a
SunOS ohtsu.local 5.11 joyent_20110922T212927Z i86pc i386 i86pc Solaris
````
When I compiled node with not -O3 but -O, it works fine.

````
[node@ohtsu /var/tmp/node]$ ./node_O ./test.js
{ f: [Function] }
````

I'm not sure the reason, however, the workaround is to change the optimize option -O3 in https://github.com/joyent/node/blob/master/common.gypi#L43 into -O as
````
'cflags': [ '-O', '-fdata-sections', '-ffunction-sections' ],
````
Due to this issue, "make test" always hangs up in SmartOS in test/common.js