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

OS X: (libev) kevent: Bad file descriptor #22

Closed
jhs opened this issue Jul 19, 2012 · 4 comments
Closed

OS X: (libev) kevent: Bad file descriptor #22

jhs opened this issue Jul 19, 2012 · 4 comments

Comments

@jhs
Copy link

jhs commented Jul 19, 2012

Hi, Charlie. What is the status of forking on OS X?

I am daemonizing in the first tick; but subsequent i/o is failing.

I am not certain, but I believe I am getting this error the first time I do i/o on a file (Unix socket); but not the first time I do i/o at all (I opened the socket).

I saw that you have discussed this in related projects; and I imagine you are using daemon.node in your own work. So how have you gotten it working on OS X?

Thanks!

@AvianFlu
Copy link
Collaborator

You can try to make sure you're using daemon.node@0.5.1, or you can try my node-prefork, but really, you should just move to node 0.8.x.

If you fork a node 0.6 process, you lose the thread pool. Period. It won't work.

If you use node 0.8, you can use the detached option to child_process.spawn to achieve the same kind of daemonization - but the direct forking that these modules try to do just won't work with node anymore.

@jhs
Copy link
Author

jhs commented Jul 19, 2012

Thanks. I'm on node 0.8.1, which is why I was surprised to see the error. Are you saying that this package works on 0.8, or that I should just use the detached option in spawn?

The detached option does runs setsid(); however I don't want to shell out a subprocess, I want to fork into the background! But yeah, if you say that is more reliable (and I assume you know that from hard-won experience) then I'll just have the program spawn itself, detached, or something similar.

Thanks!

@indexzero
Copy link
Owner

@jhs in forever we spawn bin/forever as a detached child process, then spawn the child-process.

@jhs
Copy link
Author

jhs commented Jul 20, 2012

Thanks, all. I think we can close this ticket as having several workarounds identified.

@jhs jhs closed this as completed Jul 20, 2012
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