Unitech / pm2-interface

Deprecated
Other
90 stars 14 forks source link

Code hangs with node 0.10.30 release #15

Closed rragan closed 10 years ago

rragan commented 10 years ago

This is a reduced case from a larger piece of code that hangs with 100% cpu usage by node when pm2 is not installed. The setInterval runs once (usually) and then things hang up at 100% cpu. If pm2 is installed, the code does not hang or if node 0.10.29 and earlier are used it does not hang.

var ipm2 = require('pm2-interface')();
var interval = setInterval( function () {
        console.log("FIRED");
    }, 500);

I'm not deliberately trying to use pm2-interface when pm2 is not installed but my code is auto-detecting to see if pm2 is being used or cluster2 module. The ipm2 line is at the top of the module and is unconditionally executed so I can avoid the problem by moving the line so the execution only happens if pm2 is around. Nevertheless, I wanted to report this because I don't know what changed in node 0.10.30 and whatever did it may pop up in other circumstances. I will also report it to the node issues.

rragan commented 10 years ago

There was an issue introduced by 0.10.30 that makes timers with non-integer timeouts hang the process. While it doesn't seem that you use timers with non-integer timeouts, the symptoms are pretty similar. See issues #8065 and #8068. A fix for this problem (see #8073) was merged in the v0.10 branch.

I tried the fixed branch and the problem went away. Look for node 0.10.31 publishing to fix this..