-
Notifications
You must be signed in to change notification settings - Fork 158
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
Cannot seem to kill the process properly #65
Comments
Command: Both graceful and not result in the same output. |
If I had to venture a guess then it is probably due to the socket not being closed fast enough (still waiting for an ACK from some connection, for example) and is still in There is no real fix for this other than terminating the connections beforehand (or not keeping them open at first) or to wait some time before the command the next time (in a pickle you could create a shell script that runs |
So I've found the reason, it's because it's not actually killing the child processes. Even if I do the second thing in a bash script, it doesn't kill the server pid it kills the parent process pid. See: https://stackoverflow.com/questions/24982845/process-kill-on-child-processes When I re-execute the binary it works and kills and restarts it properly (although the code obviously doesn't change). I would argue that this library should kill the child processes too. |
ahh my bad there's a build command, so that does work! Thanks! |
See https://medium.com/@felixge/killing-a-child-process-and-all-of-its-children-in-go-54079af9477 for a detailed explanation of how this works. For now this only implemented for posix and these changes should have no effect on windows. This fixes githubnemo#65 and makes the script in githubnemo#72 work (without this fix the script would be terminated on re-compile, but the go executable would continue to run, potentially causing issues with used resources like files and sockets)
I'm obviously missing something, but I can't seem to catch the SIGTERM signal and gracefully terminate the running server.
Results in:
The text was updated successfully, but these errors were encountered: