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

fix: stop erts when end of input is reached #42

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

clark-lindsay
Copy link
Contributor

This ensures that the runtime will shut down if input is closed, eliminating zombie processes that are left when an explicit "shutdown" message isn't sent to the LS.

I elected to use System.stop/1 instead of System.halt/1 since a careful shutdown of the system seemed preferable.

Testing

I tested the change by replacing the gen_lsp dependency in next-ls with my local version, which includes the change, and comparing the behavior of sending an "End of Transmission" event to a running next-ls instance (started with bin/start --stdio).

Before the change

Running epmd -names | wc -l after starting the server produced 11 (from zombies already on my machine, plus the new server). Without adding the System.stop/1 call and sending an EOT using ^D the server does not stop.

After the change

Running epmd -names | wc -l after starting the server produced 11. Sending an EOT using ^D causes the server to stop, and a subsequent execution of epmd -names | wc -l produces 10.

This ensures that the runtime will shut down if input is closed,
eliminating zombie processes that are left when an explicit "shutdown"
message isn't sent to the LS.
@mhanberg
Copy link
Collaborator

Tested it myself, works with both stdio and tcp mode. I was able to test tcp by doing nc localhost 9000 and then ctrl-c ing out of that, and just for good measure, I had it print out something before it shut down

@mhanberg mhanberg merged commit 4650300 into elixir-tools:main Oct 27, 2023
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.

None yet

2 participants