Skip to content

Node.js app with cluster does not execute inside Nodeclipse // Unknown system errno 203 #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paulvi opened this issue Oct 10, 2013 · 15 comments

Comments

@paulvi
Copy link
Member

paulvi commented Oct 10, 2013

This code with cluster usage does not execute inside Nodeclipse

    var cluster = require('cluster');
    var numCPUs = require('os').cpus().length;

    if (cluster.isMaster) {
        // Fork workers.
        for ( var i = 0; i < numCPUs; i++) {
            cluster.fork();
        }

        cluster.on('death', function(worker) {
            console.log('worker ' + worker.pid + ' died');
            cluster.fork();
        });
    }

It is finishing with

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn Unknown system errno 203
    at errnoException (child_process.js:945:11)
    at Process.ChildProcess._handle.onexit (child_process.js:736:34)

Possibly output is less, because of #71

@zamnuts
Copy link

zamnuts commented Oct 16, 2013

@paulvi I was able to reproduce this. It affects nodeclipse version 0.5.0.201309080643 and latest 0.6; reverting to 0.4.0.201305191444 resolves the issue (temp fix).
However, I am getting a more detailed error message (not sure if it is related, exactly):

Error: write EPIPE - cannot write to IPC channel.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE - cannot write to IPC channel.
    at errnoException (child_process.js:980:11)
    at ChildProcess.target.send (child_process.js:455:16)
    at ****.startNodes (****.js:58:10)
    at new **** (****.js:30:7)
    at Object.<anonymous> (****.js:117:10)
    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 Function.Module.runMain (module.js:497:10)

Version Information:

  • Eclipse Version 4.2.2
  • JDK 1.7.0_13 (64-bit)
  • Node.js 0.10.16 (64-bit)
  • Windows 7 (64-bit)

I used the following updates to switch between versions (clean uninstalls and restarts of workspace each time, of course):

...In other news, it would be nice to keep the version history intact on the primary update site(s) so you can revert to a previous eclipse configuration (under "Installation History"). When using the current update sites for 0.5 and 0.6, Eclipse says it cannot find the old plugin versions.

@paulvi
Copy link
Member Author

paulvi commented Oct 16, 2013

Do you mean that the same Node.js code produces different errors in Eclipse?

by the way http://dl.bintray.com/nodeclipse/nodeclipse is actually mirror of 0.5
the latest 0.6 is at http://dl.bintray.com/nodeclipse/nodeclipse/0.6.0/
(that is switch to Bintray after it proved to be better then GitHub pages)

The latest 0.7

$ git clone git://github.com/Nodeclipse/nodeclipse-1.git

Then build with

$ mvn package

@ghost ghost assigned paulvi Oct 16, 2013
@paulvi
Copy link
Member Author

paulvi commented Oct 16, 2013

@zamnuts There is no need to install/unistall plugins. Just get second(third..) Eclipse .
(And open the same project in different Eclipses. And since 0.6 even debug in the same time by setting different debug ports)

For example Enide Studio http://sourceforge.net/projects/nodeclipse/files/Enide-Studio/
It will be faster comparing to Eclipse 4.2.2

Then you can set once more Eclipse and update Nodeclipse. there is very convinient Nodeclipse plugin list under Help menu.

@zamnuts
Copy link

zamnuts commented Oct 16, 2013

@paulvi Using your original Cluster source I get the same results you do:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn Unknown system errno 203
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

That is with a new project and nodeclipse 0.6.

The error I received was also relevant to ChildProcess and occurred during provisioning of those child processes. The difference is that Error: spawn Unknown system errno 203 is presented when using Cluster while Error: write EPIPE - cannot write to IPC channel. is presented when using ChildProcess directly.

To reproduce (using the sample code from http://nodejs.org/api/child_process.html#child_process_child_send_message_sendhandle), first use main.js

var cp = require('child_process');

var n = cp.fork(__dirname + '/sub.js');

n.on('message', function(m) {
  console.log('PARENT got message:', m);
});

n.send({ hello: 'world' });

...and sub.js:

process.on('message', function(m) {
  console.log('CHILD got message:', m);
});

process.send({ foo: 'bar' });

Works in 0.4, but produces in 0.6:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE - cannot write to IPC channel.
    at errnoException (child_process.js:980:11)
    at ChildProcess.target.send (child_process.js:455:16)
    at Object.<anonymous> (C:\dev\workspaces\test\fork-test\main.js:9:3)
    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 Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

I'm not saying it is the same error, but it is a pretty close coincidence, don't you think? If you feel these are unrelated, I can open a separate bug report.

btw, i ended up just duplicating my eclipse directory and installed the other version (for now), thanks for the tip

@paulvi
Copy link
Member Author

paulvi commented Jan 1, 2014

I wonder if using V8 debugger coming with 0.4 version e.g. taking Nodeclipse NTS http://sourceforge.net/projects/nodeclipse/files/ but with Nodeclipse itself being the latest could work.

@ihgreenman
Copy link

I'm seeing this issue (in a different context) as well.

Exercising a little Google-fu, I came up with errno 203 is "Environment variable missing"

Looking at process.env, it only has one item, "SystemRoot". No PATH, no nothing else.

@ihgreenman
Copy link

It looks like in the "Edit launch configuration properties" window that the "Append to environment" is not working properly; it appears that no matter what that the native environment variables are getting nuked.

copied to #122

@ihgreenman
Copy link

OK, workaround on my system. YMMV; you may need more than these.

Open cmd.exe and run "set" to get the environment variables for your system.

Take note of the values for "PATH", "TEMP", "TMP", and "SystemDrive".

Open the properties for the nodeclipse project. Click on Run/Debug Settings, then edit the launch configuration that is failing. Click on "Environment". Add the four environment variables above.

@paulvi
Copy link
Member Author

paulvi commented Feb 3, 2014

Do I understand right that the cause errno 203 is "Environment variable missing"
and it should be fixed when "PATH", "TEMP", "TMP", and "SystemDrive" are passed?

paulvi pushed a commit that referenced this issue Feb 3, 2014
@paulvi
Copy link
Member Author

paulvi commented Feb 3, 2014

With commit above the example code can run inside Eclipse at least on Windows

var cluster = require('cluster');
var numCPUs = require('os').cpus().length;

if (cluster.isMaster) {
    // Fork workers.
    for ( var i = 0; i < numCPUs; i++) {
        cluster.fork();
    }

    cluster.on('death', function(worker) {
        console.log('worker ' + worker.pid + ' died');
        cluster.fork();
    });
} else {
    console.log('worker');
}

@paulvi
Copy link
Member Author

paulvi commented Feb 3, 2014

@zamnuts example also works (on Windows)

@ihgreenman
Copy link

@paulvi, you are correct: The issue being reported by errno 203 is that a required environment variable is missing. For my environment, I needed to set those four variables.

@paulvi
Copy link
Member Author

paulvi commented Feb 4, 2014

OK, so this #81 is not actually bug, because code will run once those environment variables are set.
So we are working on enhancement to pass those environment variables correctly under major OSes.

Also @ihgreenman Ian, I copied ""Append to environment" is not working properly" into #122. Do you have code snippet to test this. Please continue in #122 .

@centaurus45
Copy link

The fix of setting the environment variables within the run configuration worked for me; I can run the application through Nodeclipse. However, when running the application in debug mode (also with the environment variables set), the node js application will hang after creating the cluster workers. No errors are thrown. If I remove the cluster code, the application will run in debug mode just fine.

Update, below is how I got around the problem described above

https://github.com/department-of-veterans-affairs/vlerdas-ecrud/pull/71

@Stelminator
Copy link

@palcocer I found this while trying to debug a nodejs cluster app, but your link is dead. Any chance you could explain your workaround here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants