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

Question: What is the proper way to shutdown ksync #273

Closed
BarryDrez opened this issue Feb 21, 2019 · 7 comments
Closed

Question: What is the proper way to shutdown ksync #273

BarryDrez opened this issue Feb 21, 2019 · 7 comments

Comments

@BarryDrez
Copy link

I am starting ksync from Java using ProcessBuilder. Running ksync watch on Windows which starts ksync_windows_amd64.exe and 2 syncthing.exe(s). When I shut it down programmatically, the ksync_windows_amd64.exe goes away, byt the 2 syncthing.exe(s) remain. What is the proper command to stop watching?

@timfallmk
Copy link
Collaborator

You probably want ksync clean --local

@BarryDrez
Copy link
Author

This does not work on Windows.

@BarryDrez
Copy link
Author

Why was this closed?

@timfallmk
Copy link
Collaborator

timfallmk commented Feb 26, 2019

@BarryDrez A little more background here. Running ksync watch on Windows requires running the primary process in the foreground, as daemonization is not supported on that platform. When the primary process exists, it collapses the process group, including killing all child processes. You can see this for yourself by running it in a terminal.

I suspect that whatever you're using to launch the parent process is preventing the normal control of child processes, that's why you're having left overs left behind when it exits.

I'm happy to help debug this with you, but as it isn't an internal ksync issue I've closed it so it's not in our development tracking.

@BarryDrez
Copy link
Author

@timfallmk in its simplest form, this is the Java code I used to start ksync:

ProcessBuilder pb = new ProcessBuilder("C:\\ksync\\ksync_windows_amd64.exe", "watch");
pb.directory(new File("C:\\ksync")); 		            
watchProcess = pb.start();

I understand your explanation, and I will look into an alternative solution.

@timfallmk
Copy link
Collaborator

I'm less familiar with Windows (or Process Builder for that matter), but it's likely attaching its own process management to that process, which is interfering.

You might find some inspiration from the way we deal with deamonization on other platforms. Also, it's easy to find (and cleanup) the child processes, by looking for which processes are using the ports given in the config (the *nix equivalent would be using losf -i). Hopefully that gives you some ideas.

@BarryDrez
Copy link
Author

Thank you. I will do some digging.

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

2 participants