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

Get rid of orphan gauge processes #166

Closed
sriv opened this issue Jun 28, 2015 · 10 comments
Closed

Get rid of orphan gauge processes #166

sriv opened this issue Jun 28, 2015 · 10 comments
Milestone

Comments

@sriv
Copy link
Member

sriv commented Jun 28, 2015

From @sriv on October 28, 2014 6:42

If Visual Studio is killed or crashes, the child gauge processes are orphaned. These need to be killed.

Copied from original issue: getgauge/gauge-visualstudio#1

@sriv
Copy link
Member Author

sriv commented Jun 28, 2015

There is check to gracefully kill child processes from within the runner. Unfortunately, at least in windows there is no easy way [AFAIK] to register a child process to be killed when parent dies, unless there is an explicit "kill process tree" instead of "kill process".

Suggestions welcome.

@sriv
Copy link
Member Author

sriv commented Jun 28, 2015

From @navaneeth on June 26, 2015 7:12

You do this the other way. When Gauge starts, it gets the parent's pid. And keep looking whether the pid is available. If not, it can exit itself. This can be controlled via a command line flag so that it is applicable only when required.

@mahendrakariya
Copy link
Contributor

We should take a look at this article. It could be relevant here.
https://medium.com/@felixge/killing-a-child-process-and-all-of-its-children-in-go-54079af94773

@navaneeth
Copy link
Contributor

@mahendrakariya That article won't help. The approach said in that article works if you have control to trigger the terminate on child process. In this case, gauge parent process itself died making the child go orphan. AFAIK, there is no better way to fix other than the one that was suggested. Rather than relying on PID, which could be reused in some operating systems, you could make a ping API on the gauge core which the runner can keep pinging and if the ping fails, it can exit.

@mahendrakariya
Copy link
Contributor

That's a nice idea @navaneeth. I agree with you. We should do that.

@Thunderforge
Copy link

I should point out that this issue also affects installing a new version of Gauge. During the installation, the user is shown an error message involving "gauge.exe":

image

Opening up task manager and killing each process for gauge.exe, then clicking "Retry" is a workaround, but it should not be necessary to do this.

@kashishm
Copy link
Contributor

It was also happening with Intellij on Linux, Mac and Windows.
After @mahendrakariya's commit, it is fixed on Linux and Mac but not for windows.

@kashishm kashishm removed this from the 0.3.2 milestone Feb 11, 2016
@navaneeth
Copy link
Contributor

This is not working because the implementation uses getppid which is not implemented for Windows.

@mahendrakariya
Copy link
Contributor

Looks like it's implemented (in syscall_windows.go) in golang 1.5.

We have asked the broader community for some help. Here's the thread. https://groups.google.com/forum/#!topic/golang-nuts/p-H5ODtTXIw

@mahendrakariya
Copy link
Contributor

Tested on Windows 8.1 and Windows 7 with both VS and IntelliJ. If the IDE gets killed, gauge daemon is also terminated within 1 second.

@mahendrakariya mahendrakariya added this to the 0.3.3 milestone Feb 15, 2016
@sriv sriv added this to the 0.3.2 milestone Apr 26, 2016
@sriv sriv added bug and removed bug labels Apr 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants