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

Kill all related process when exiting #2

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

Kastakin
Copy link
Contributor

I noticed that on Windows the processes are not exited correctly.
The execa package create an Rscript process that launches the start-shiny.R script in main folder. This in turn creates an R process and another Rscript process, both related to the Shiny dashboard.

When closing the main window the main process created by execa is terminated but the other two are left there as zombie processes and the Shiny dashboard can still be accessed if a web browser is pointed to the correct port.

I propose a workaround I implemented for an upcoming app we are developing at my university that is based on this comment I found in a related issue on the execa GitHub.

The related pid of the process are kept in memory and manually terminated when exiting if they are still alive.

@jhk0530
Copy link
Contributor

jhk0530 commented Jan 17, 2024

Hi Kastakin.

As you mentioned. It's annoying that R doesn't exit clearly in windows.

I understand using pidtree will clear this issue.

Right?

@Kastakin
Copy link
Contributor Author

That is correct!
The modification to the code I did use pidtree to get the actual list of R child processes and terminate them if they are alive once the application is closed.

@jhk0530
Copy link
Contributor

jhk0530 commented Jan 18, 2024

Nice work.
I tried it and it works as expected.

@jhk0530 jhk0530 merged commit dd45de7 into zarathucorp:main Jan 18, 2024
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

Successfully merging this pull request may close these issues.

2 participants