Fork me on GitHub
#lsp
<
2023-03-23
>
dpsutton15:03:29

I'm having an issue setting up clojure-lsp on wsl in windows. I'm downloading the https://github.com/clojure-lsp/clojure-lsp/releases/tag/2023.01.26-11.08.16

curl -L -O .
16/clojure-lsp-native-static-linux-amd64.zip
and then unzipping it into ~/bin which is on my path and on emac's exec path. Clojure lsp starts up correctly, analyzes the project and then dies. I'm greeted with the following message: > Server clojure-lsp:4111/starting exited (check corresponding stderr buffer for details). Do you want to restart it? (y or n) n The server output has lots of output that looks like regular analyzing. The buffer *clojure-lsp::stderr* has > Process clojure-lsp stderr finished I'm not sure what else to look at to figure out why it seems to just be exiting.

dpsutton15:03:11

usuing the january release to work around the defcatchall bug. still haven't fixed that quite yet

dpsutton15:03:00

nothing looks strange in there

ericdallo15:03:29

That's weird, no exceptions, does the same happens running via CLI?

clojure-lsp diagnostics
for example

borkdude15:03:21

try which clojure-lsp in a wsl(2?? please specify the 2 if you're using wsl2, wsl is a completely different thing) console

borkdude15:03:57

the reason I'm suggesting that is that wsl2 might pick up on windows executables

ericdallo15:03:32

makes sense, even so, I can't see why a crash without any exception anywhere

dpsutton15:03:22

wsl2 (sorry about that) from an emacs eshell:

~ $ which clojure-lsp
/home/dan/bin/clojure-lsp
~ $ clojure-lsp --version
clojure-lsp 2023.01.26-11.08.16
clj-kondo 2023.01.20
and same output from a wsl2 terminal

dpsutton15:03:50

yeah. i don't see anything dying. It just kinda seems like the program finishes

dpsutton16:03:14

i missed that originally @UKFSJSM38 sorry about that. What a great diagnostic tool.

clojure-lsp diagnostics
[ 20%] Analyzing project files     Killed

dpsutton16:03:21

no idea what's up. maybe memory constraints?

borkdude16:03:52

diagnostics means "lint" basically, it's not to diagnose lsp itself ;)

dpsutton16:03:20

ah there it is. i'm running out of memory and swapping

borkdude16:03:21

what is the exit code?

dpsutton16:03:33

let me rerun and get the code

dpsutton16:03:39

it's $status?

borkdude16:03:42

right, you need to up the docker memory then probably

borkdude16:03:15

or no, the wsl.conf file

dpsutton16:03:21

yeah. no docker involved

dpsutton16:03:43

> Exit code 137 occurs when a process is terminated because it's using too much memory.

dpsutton16:03:02

ok issue solved. will take some $ to solve this one. The computer only has 16gb

dpsutton16:03:06

thanks and sorry for the noise

borkdude16:03:07

from my blog:

Some closing tips.

There is a known issue with memory usage of WSL2. Since linux uses non-allocated memory for filesystem caching, Windows thinks this memory is really used. As time goes by, Windows could end up allocating all your system's memory to WSL2. To put a limit to this, I use this config in C:\Users\borkdude&#46;wslconfig:

[wsl2]

memory=92GB
https://blog.michielborkent.nl/remote-wsl2-clojure.html

dpsutton16:03:26

i'm going to order 64 and then allocate it accordingly

borkdude16:03:28

dunno if you have that configured or not

dpsutton16:03:45

i don't but don't have a ton to start with. inheriting wife's old computer so will have to bump that

borkdude16:03:56

I mean 8-16gb should be enough I think, but my PC has 128gb so why not give it more ;)

seancorfield16:03:41

I configured WSL2 to get 20GB on my 32GB Windows desktop (and 12GB on my 16GB Windows laptop I think). If you have 16GB, then configuring it to 12GB should be plenty for most stuff... I can run a lot of things that way.

seancorfield16:03:07

But moar RAM is always better 🙂

dpsutton16:03:14

it was swapping heavily on the 8gb given to it. I’ll order 64 and give it 32.

seancorfield16:03:00

I thought it automatically used half of total RAM...? But maybe it's just half of free RAM? @U04V15CAJ?

dpsutton16:03:48

i think it had 8gb of the 16. But with slack, chrome, spotify in the windows os, then clojure-lsp, the clojure backend, node running the frontend, postgres, it just got to be too much

seancorfield16:03:10

Yeah, I can imagine. Here's my 32GB desktop right now:

seancorfield16:03:30

Slack, Edge, Docker (running Elastic Search, MySQL/Percona, and Redis), multiple Terminals each running REPLs etc, Mail, Calendar, Zoom, To Do, VS Code (three instances).

borkdude16:03:17

I think the max memory setting isn't enforced by default, at least it was like this when I started with wsl2, but it could be that it is done now.

seancorfield17:03:57

"By default the WSL2 will consume up to 50% of your total system memory (or 8GB whichever is lower)." -- so it won't use more than 8GB unless you configure it to do so, even on large systems.

👍 2
seancorfield17:03:07

@U11BV7MTK In particular localhostForwarding (defaults to true) re: our earlier conversation about using localhost on Windows.

🎉 2
borkdude17:03:11

it seems they have improved the defaults then :)

borkdude17:03:52

btw, I've also installed tailscale on my windows machine. I'm almost never (maybe once a year) connected to it via a screen, always do it via the network, to debug windows and linux stuff

dpsutton18:03:59

this is before i started clojure-lsp