Skip to content
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

OSX Bad File Descriptor Issue? #2

Open
indexzero opened this issue Nov 3, 2010 · 5 comments
Open

OSX Bad File Descriptor Issue? #2

indexzero opened this issue Nov 3, 2010 · 5 comments

Comments

@indexzero
Copy link

I can confirm that this is an issue with node v0.3.0:

http://slashed.posterous.com/writing-daemons-in-javascript-with-nodejs-0#pcomment_commentunit_5698960

Any thoughts here? We run on both Ubuntu (production) and OSX (development) environments, so we need a cross-platform solution.

@petrjanda
Copy link

Hey,

I am not sure if you are still interested in this but today I was busy probably with the same thing.

I bet you mean this error "Getting (libev) kevent: Bad file descriptor on OSX" happening only on your OSX right?
I tracked down the problem to the libev, used by node.js and got to its docs here: http://doc.dvgu.ru/devel/ev.html.

There you can find the function ev_default_fork(). From the description I understand that the event loop need to reinitialized after fork() of new process, so I've added the call right after the new process is created. Did help with the error, but I got different one though. Not sure what it is but perhaps looks like something else got corrupted. This is the output I have:

node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ENOTSOCK, Socket operation on non-socket
at Array. (net.js:1078:7)
at EventEmitter._tickCallback (node.js:108:26)

I am trying to setup new http.Server after the fork btw.

@petrjanda
Copy link

@indexzero
Copy link
Author

@petjanda Interesting! I'll have to play around with this sometime soon.

@petrjanda
Copy link

Then please ping me once you will make some progress in that, I will do the same.
This will probably require a more deep look into node.js internals to find out what is happening inside the event loop :/

@mineshaftgap
Copy link

Is there any movement on this bug? I am running daemon.node 0.5.1, node 0.8.14, Mac OSX 10.8.2 and this still seems to be happening. Is any plan to make this work on Max OSX?

Thanks and here is the test code:

var daemon = require('daemon'),
    pid    = daemon.start('test-stdout.log', 'test-stderr.log');

daemon.lock('/tmp/test.pid');

require('http').createServer(function (request, response) {
    response.end(request.url);
}).listen(1234, '0.0.0.0');

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

No branches or pull requests

3 participants