slatex / sTeX-IDE

GNU General Public License v3.0
0 stars 0 forks source link

MacOS: Ports are always "already in use" #1

Closed kohlhase closed 2 years ago

kohlhase commented 2 years ago

Whenever I start up VSCode on my Mac, I have to choose a new port number in the sTeX IDE Settings. It seems that on MacOS the ports are not closed correctly?

Jazzpirate commented 2 years ago

That would mean that VSCode on MacOS doesn't shut down the language server on quitting. That would be a substantial bug in VSCode. Can you check your running processes (when VS Code is running) whether you can find MMT somewhere in there and whether the process is terminated after closing VS Code?

Jazzpirate commented 2 years ago

...it's probably an isntance of java, unfortunately, that might make it hard to identify

kohlhase commented 2 years ago

I have opened vscode, and waited until it said "connected to sTeX", then I see

kohlhase@localadmins-MBP ~ % ps aux | grep java
kohlhase          2443   0.0  0.0 34122844    836 s000  S+    1:55PM   0:00.00 grep java
kohlhase          2055   0.0  1.5 44347284 254432   ??  S     1:54PM   0:07.55 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -Xmx8192m -classpath /Users/kohlhase/vc/git/github.com/UniFormal/MMT/deploy/mmt.jar info.kwarc.mmt.stex.lsp.Main /Users/kohlhase/localmh/MathHub 9115
ko

Process 2055 persists even after vscode has been quit. When I start vscode again, I get

kohlhase@localadmins-MBP ~ % ps aux | grep java  
kohlhase          2563  96.9  1.5 44351472 255608   ??  S     1:57PM   0:05.70 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -Xmx8192m -classpath /Users/kohlhase/vc/git/github.com/UniFormal/MMT/deploy/mmt.jar info.kwarc.mmt.stex.lsp.Main /Users/kohlhase/localmh/MathHub 9115
kohlhase          2055   0.0  1.5 44346248 254316   ??  S     1:54PM   0:07.64 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -Xmx8192m -classpath /Users/kohlhase/vc/git/github.com/UniFormal/MMT/deploy/mmt.jar info.kwarc.mmt.stex.lsp.Main /Users/kohlhase/localmh/MathHub 9115
kohlhase          2691   0.0  0.0 34132060    876 s000  S+    1:57PM   0:00.00 grep java

and after I quit vscode again, the two java processes persist.

Jazzpirate commented 2 years ago

So, the server calls scala.sys.exit() if it a) is run locally (as is the case with you) and b) it receives a "shutdown" lsp-request. On linux that seems to be sufficient. I've just added the same functionality to the "exit" lsp-request. Can you pull MMT@devel, do sbt deploy and see whether that fixes it?

kohlhase commented 2 years ago

no, the java process still survives

Jazzpirate commented 2 years ago

Ok, that's just utterly weird. I'll have to investigate that. Might take some time unfortunately, I'll have to set up everything on the mac

kohlhase commented 2 years ago

sorry for that. It might be better to involve Tom? He has used MMT on a mac

kohlhase commented 2 years ago

And in any case, it is not urgent. Just wanted to report this.

Jazzpirate commented 2 years ago

I first want to make sure that either of the two lsp requests is actually issued to the LSP. If one of them is, then it's possibly an issue for Tom. If neither is, I'll need to see what else arrives at the server, as to shut down MMT.

Jazzpirate commented 2 years ago

Wait - is this possibly some MacOS-thing where "closing" a window doesn't actually close the software but just minimizes it or something?

kohlhase commented 2 years ago

No, I checked, the vscode processes seem to go away when closing application.

kohlhase commented 2 years ago

this seems to (mostly) be fixed.