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

Calva leaves running java.exe processes on Windows when closing VS Studio #305

Closed
cfehse opened this issue Sep 8, 2019 · 10 comments
Closed

Comments

@cfehse
Copy link
Contributor

cfehse commented Sep 8, 2019

When you open a clojure project and Jack-in a repl for lets say a leiningen project the extension starts 2 java.exe processes. If you close VS code one process is left running.

The output windows states:
Jack-in done.
Use the VS Code task management UI to control the life cycle of the Jack-in task.

If I therefore terminate the running task using Terminal->Terminate Task... (which ends one of the 2 processes) and terminate VS code afterwards there is one leftover process as well.
This running process seems to be a running repl . If you start VS code again an choose "Connect to a running repl server" the connection is established an the repl window works as expected. In this state there is no running task to terminate and if you close VS code again the java.exe process is still running. So for each time starting VS code jack-in a repl an terminating VS code one additional process is left running.

I just noticed this behavior because I tried to figure out how the extension and VS code works and therefore restarted VS code quite some times which leaves an unusual number of java processes in the task manager.

@PEZ
Copy link
Collaborator

PEZ commented Sep 8, 2019

Hello, thanks for pointing this out. It should be mentioned in the documentation. It is a VS Code + Windows issue, but still people should be aware of it.

@cfehse
Copy link
Contributor Author

cfehse commented Sep 8, 2019

Okay - and a bunch of conhost.exe processes are left over as well.

@PEZ
Copy link
Collaborator

PEZ commented Sep 8, 2019

@kstehn: Do you think using Task provider properly would have a chance to fix this?

@kstehn
Copy link
Contributor

kstehn commented Sep 8, 2019

Not sure it might.
Dont know how difficult it would be to do it right.

The two java processes are normal.
One is the leiningen-repl itself and the other is the project that gets started by leiningen.

@PEZ
Copy link
Collaborator

PEZ commented Sep 8, 2019

Thing is that on Linux and Mac VS Code brings down the processes on reload and exit. But we know that we are using the Task a bit too loose for the VS Code devs' taste. And just maybe if we did it through a Task provider vscode would do the right thing on Windows as well. But, we should do it though a task provider anyway, of course.

@cfehse
Copy link
Contributor Author

cfehse commented Sep 9, 2019

The nREPL protocol itself seems not to support a termination of the server initiated by a client. A workaround for this is to simply call "(System/exit 0)" from the repl window (mentioned here clojure-emacs/cider#390).
Perhaps something similar can be included into the termination code of the extension to terminate the repl processes in case the extension started the repl by itself and was not connected to a running instance.

@cfehse
Copy link
Contributor Author

cfehse commented Sep 14, 2019

@PEZ: My changes for this didn't make to version 2.0.37 right? So I use my local build based on your merged dev branch until it's coming up from the marketplace. Thanks for merging!

@PEZ
Copy link
Collaborator

PEZ commented Sep 14, 2019

That's right. I have messed up my branches because of low git fu, so cut the release just before your fix. Will try to fix today, but might be tomorrow.

@cfehse
Copy link
Contributor Author

cfehse commented Sep 14, 2019

@PEZ No worries! Take your time - it's weekend. *gg,

@PEZ
Copy link
Collaborator

PEZ commented Sep 14, 2019

Should be fixed now. Close issue if you agree. 😄

@cfehse cfehse closed this as completed Sep 15, 2019
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

No branches or pull requests

3 participants