Heya guys.
I REALLY don’t know where to ask this question, or how to even tag it properly. Doing the usual google / clojureverse search didn’t help much either…
Why does the nREPL server just up and disconnect after a period of inactivity?
just open up a project in, say, VSCode / Calva
jack-in to the REPL
…
get up to have lunch or some other AFK activity
come back to it a~and
it’s automatically disconnected, the server is shut down, you have to jack-in again
Why?
Is there some security / stability concern with staying connected to the REPL?
Is there a “keep alive” setting somewhere I need to configure?
Am I insane for wanting an “immutable” environment to stay how I left it, no matter for how long?
The nREPL server is happy to stay connected forever, and so is Calva.
Perhaps you connect Calva to an nREPL port on another machine, and either an SSH server or a firewall disconnects it?
I am on windows most of the time. Never had a problem with long running repl, even through suspension/hibernation. I used emacs + cider though. Fascinating. No WSL crutch.
My best guess is that your network interface is for some reason getting interrupted and probably restarts. It could be drivers, it could be something else. But I doubt it has anything to do with nRepl, except perhaps for the fact that nRepl doesn’t have support for reconnecting after a disconnect.
I tested it a few more times
on 2 machines (on the same home network, 1 lan, 1 wi-fi, if that should matter at all)
both with local leiningen installs
both lasting at most a few hours, with inconsistent time spans
Have you tried setting up a minimal lein install inside WSL? Do you see the behavior there? For example, after enabling WSL and installing Ubuntu from the Windows store, go to the Ubunto CLI and
# Get Java and the curl utility
sudo apt install default-jdk curl
# Download lein and make it executable
curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
# repl-y away!
./lein repl
(I didn’t test the above but it should be very close if not correct.)
alright, not to be mean to the people who are trying to help me or anything…
still, since my homework is getting more and more elaborate with each suggestion, let’s take a step back and look at the big picture:
what I wanted at the end of this road was “taking my hands off the keyboard without the fear of REPL disconnecting on a whim”
with a subtext of “why the heck should jacking-in or staying connected be manual anyway?”
and now it’s coming down to erecting temples in honor of the REPL gods and sacrificing a virgin every time I need to jack-in…
again, I’m sorry if I sound ungrateful for your advice
You appear to be an extreme outlier since this is possible for everyone who has responded. Staying connected is not typically a manual prospect; it just works (although connection stability is dependent on the underlying protocols). jacking in is a choice since you are interacting with a running process (local or remote).
erecting temples in honor of the REPL gods and sacrificing a virgin every time I need to jack-in
Given the extreme nature of your situation, people are providing suggestions to explore possible reasons for this oddity. It’s weird.
Hi
a couple of things that might cause your issue that I can think of is 1- if you are following the tutorial and tried the Ctrl-Alt-C and used the wrong port or something. I know you say you were connected; but it may be that using the wrong port might disconnect you.
Also the temp directory as you know is used for fireup demo, and it might get cleaned up and that might cause your issue.
In my case the port is 36447 and I have to specify that in the vscode command after I choose a Generic project. This is all when you you do Ctrl+Alt+C enter to connect. I do realize your original question was about getting disconnected. Just figure if you can reconnect, it may not be as much of an issue. I did experience the same by the way, but I was fiddling with the Ctrl+Alt+C enter command. Hope it helps. Basically in order to reconnect in vscode use the Ctrl+Alt+C enter, and the command pallet opens up asking which project type you like to use, and I chose “Generic”, then it populates the Command Pallet with the word “localhost”, and you have to add the port to the end of that. I found my port in the terminal from the previous session. I assume it is the same, but I am on a Linux machine. I am not sure about Windows. Good luck.