Search code examples
emacsclojurecider

`cider-jack-in' aborts with 'Protocol family unavailable'


When I run cider-jack-in I get a SocketException with Protocol family unavailable as the exception message.

lein repl runs fine on the command line.

I've web-searched and found no matches containing both 'cider' and 'SocketException', which is always worrying. Nothing obvious came up in a search of the github project nor in the list of possibly-related questions presented here by StackOverflow as I'm writing this.

I get the same error whether I have a project file loaded or not.

My Emacs session tends to be extremely long-running (months) but I've checked and the problem still recurs identically after a restart.

Things I thought of that might be at play but I think I can discount:

  • AFAIK no hosts on the subnet (this host among them) have IPv6 configured on any interface.

  • This Emacs is running on the same host as a Squid proxy server, but (getenv "no_proxy") returns a comma-delimited string that includes both localhost and 127.0.0.0/16, so no connection to the proxy server should be requested as part of connecting to an nrepl server on the same host.

  • This host has a heavily customized /etc/hosts file, but no IPv6 address mappings are enabled.

In other words it should be a "pure" IPv4 host.

emacs-version: 24.5.1

cider-version: 0.15.1-snapshot

OS: Linux this-host 4.8.0-2-amd64 #1 SMP Debian 4.8.11-1 (2016-12-02) x86_64 GNU/Linux

Stack trace header:

error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Exception in thread "main" java.net.SocketException: Protocol family unavailable, compiling:(/tmp/form-init7765774181037314573.clj:1:73)

What's wrong?


Solution

  • I doubt that cider knows or cares whether your system is purely ipv4; it still seems to default to attempting use ipv6, shown in cider's startup messaging as lein ... repl ... :host :: (the :: being ipv6 equivalent notation to localhost). For my situation, it was simple enough to just enable ipv6 on my system, but you could instead follow suggestions in this issue to set cider-lein-parameters to repl :headless :host localhost.