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

proxrox stop might kill unrelated instances of nginx #16

Open
basti1302 opened this issue Jul 16, 2015 · 0 comments
Open

proxrox stop might kill unrelated instances of nginx #16

basti1302 opened this issue Jul 16, 2015 · 0 comments

Comments

@basti1302
Copy link
Contributor

As discussed in #14

@basti1302:

On a slightly related note, it feels a little bit brute-force-y to just kill all nginx master processes. It might be quite unlikely, but there could be another, completely unrelated, nginx process around, right?

What about spawning the nginx process via node core's child_process.spawn on proxrox start, remembering the pid (in the tmp folder), and killing only the process with that pid on proxrox stop?

@bripkens:

I very much like the idea! But then proxrox stop could only stop the last started nginx process. Can we come up with a strategy to stop the nginx process which is currently running for a given .proxrox.yaml file?

I investigated a bit yesterday. The pid returned by child_process.spawnSync is not the pid of the nginx master process. Apparently nginx -c ... -p ... (the command used to start nginx) starts a short lived process which in turn spawns the master process. However, the nginx pid is already available in /tmp/proxrox/uuid/log/nginx.pid because this is configured in the nginx config template.

So we could have a look at all existing files that match the pattern /tmp/proxrox/uuid/log/nginx.pid, read the pids from those files and kill only those processes. That still would kill all nginx processes created by proxrox but it is a bit better than killing all nginx intances, even those not created by proxrox.

The alternative would be to put a file (only the pid or the whole tmp structure) into the current directory but that creates some new problems.

I think there is no third alternative, as proxrox has no persistent storage between proxrox start and proxrox stop.

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

2 participants