Skip to content

Set process group ID in server to terminate after parent #276

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

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Feb 27, 2024

Closes #274

I think there are two issues with the way we shutdown the server. We can't have the infinite loop checking if the thread is alive, because something might go wrong with the server and then we'll never kill the child process. I removed that loop and switched to a single sleep to give some time for the server to shutdown.

Also, I started setting the process group ID in the server process. This is a similar trick used in spring, which makes it so that if the parent process is terminated, then so will the server.

I believe these two should help with the orphaned process issues we've been seeing.

@vinistock vinistock added the bugfix This PR fixes an existing bug label Feb 27, 2024
@vinistock vinistock self-assigned this Feb 27, 2024
@vinistock vinistock requested a review from a team as a code owner February 27, 2024 21:47
@vinistock vinistock requested review from andyw8 and Morriar February 27, 2024 21:47
@vinistock vinistock force-pushed the vs/set_process_group_id_in_server branch from 5ab230f to 0afc8bb Compare February 27, 2024 21:51
@vinistock vinistock marked this pull request as draft February 27, 2024 22:19
@vinistock
Copy link
Member Author

Actually, this doesn't work properly. We sometimes get an operation not permitted error. We'll need to think about alternatives.

@andyw8 andyw8 force-pushed the vs/set_process_group_id_in_server branch from 0afc8bb to c53dd0e Compare February 29, 2024 16:49
@andyw8 andyw8 force-pushed the vs/set_process_group_id_in_server branch from c53dd0e to 12b2674 Compare February 29, 2024 17:04
@vinistock vinistock marked this pull request as ready for review February 29, 2024 17:42
@vinistock vinistock merged commit 019afe4 into main Feb 29, 2024
@vinistock vinistock deleted the vs/set_process_group_id_in_server branch February 29, 2024 17:43
@tisba
Copy link

tisba commented Feb 29, 2024

Thank you @vinistock! 🙇

@vinistock
Copy link
Member Author

@tisba my pleasure! Is the problem fixed on your end?

@tisba
Copy link

tisba commented Feb 29, 2024

I haven't seen it since I updated right away when I saw this PR merged and v0.3.2 released. But as I wrote in #274 I'm not sure how to reproduce the issue reliably. Will certainly report back if the issue reappears.

@vinistock
Copy link
Member Author

Sounds good. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ruby-lsp at 100% CPU hanging in RubyLsp::Rails::RunnerClient#shutdown
3 participants