cider-jack-in fails to start nrepl server

Created on 16 Mar 2017  ·  7Comments  ·  Source: clojure-emacs/cider

I'm able to run lein repl without trouble.

% lein repl
nREPL server started on port 39175 on host 127.0.0.1 - nrepl://127.0.0.1:39175
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_121-b13
...

but it won't start in Emacs. It was working two days ago, and I keep all my packages fresh within a few days, so something just changed.

Actual behavior

M-x cider-jack-in
(70 seconds pass with no repl coming up)
*Messages*
Making nrepl-create-client-buffer-function local to *nrepl-server foo* while let-bound!                                                                       
Making nrepl-use-this-as-repl-buffer local to *nrepl-server foo* while let-bound!                                                                             
Starting nREPL server via /usr/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.12\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update\
-in :plugins conj \[cider/cider-nrepl\ \"0.15.0-SNAPSHOT\"\] -- repl :headless :host ::...                                                                    
Prelude tip: Press <C-c G> to search in GitHub.                                                                                                               
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Exception in thread "main" java.net.SocketException: Protocol family unavaila\
ble, compiling:(/tmp/form-init6590227691248211762.clj:1:73)                                                                                                   
        at clojure.lang.Compiler.load(Compiler.java:7391)                                                                                                     
        at clojure.lang.Compiler.loadFile(Compiler.java:7317)                                                                                                 
        at clojure.main$load_script.invokeStatic(main.clj:275)                                                                                                
        at clojure.main$init_opt.invokeStatic(main.clj:277)                                                                                                   
        at clojure.main$init_opt.invoke(main.clj:277)                                                                                                         
        at clojure.main$initialize.invokeStatic(main.clj:308)                                                                                                 
        at clojure.main$null_opt.invokeStatic(main.clj:342)                                                                                                   
        at clojure.main$null_opt.invoke(main.clj:339)                                                                                                         
        at clojure.main$main.invokeStatic(main.clj:421)                                                                                                       
        at clojure.main$main.doInvoke(main.clj:384)                                                                                                           
        at clojure.lang.RestFn.invoke(RestFn.java:421)                                                                                                        
        at clojure.lang.Var.invoke(Var.java:383)                                                                                                              
        at clojure.lang.AFn.applyToHelper(AFn.java:156)                                                                                                       
        at clojure.lang.Var.applyTo(Var.java:700)                                                                                                             
        at clojure.main.main(main.java:37)                                                                                                                    
Caused by: java.net.SocketException: Protocol family unavailable                                                                                              
        at java.net.PlainSocketImpl.socketBind(Native Method)                                                                                                 
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)                                                                            
        at java.net.ServerSocket.bind(ServerSocket.java:375)                                                                                                  
        at java.net.ServerSocket.bind(ServerSocket.java:329)                                                                                                  
        at clojure.tools.nrepl.server$start_server.invokeStatic(server.clj:143)                                                                               
        at clojure.tools.nrepl.server$start_server.doInvoke(server.clj:121)                                                                                   
        at clojure.lang.RestFn.invoke(RestFn.java:619)                                                                                                        
        at user$eval10459.invokeStatic(form-init6590227691248211762.clj:1)                                                                                    
        at user$eval10459.invoke(form-init6590227691248211762.clj:1)                                                                                          
        at clojure.lang.Compiler.eval(Compiler.java:6927)                                                                                                     
        at clojure.lang.Compiler.eval(Compiler.java:6917)                                                                                                     
        at clojure.lang.Compiler.load(Compiler.java:7379)                                                                                                     
        ... 14 more                                                                                                                                           
Subprocess failed                                                                                                                                             

error in process sentinel: Could not start nREPL server: Exception in thread "main" java.net.SocketException: Protocol family unavailable, compiling:(/tmp/fo\
rm-init6590227691248211762.clj:1:73)                                                                                                                          
        at clojure.lang.Compiler.load(Compiler.java:7391)                                                                                                     
        at clojure.lang.Compiler.loadFile(Compiler.java:7317)                                                                                                 
        at clojure.main$load_script.invokeStatic(main.clj:275)                                                                                                
        at clojure.main$init_opt.invokeStatic(main.clj:277)                                                                                                   
        at clojure.main$init_opt.invoke(main.clj:277)                                                                                                         
        at clojure.main$initialize.invokeStatic(main.clj:308)                                                                                                 
        at clojure.main$null_opt.invokeStatic(main.clj:342)                                                                                                   
        at clojure.main$null_opt.invoke(main.clj:339)                                                                                                         
        at clojure.main$main.invokeStatic(main.clj:421)                                                                                                       
        at clojure.main$main.doInvoke(main.clj:384)                                                                                                           
        at clojure.lang.RestFn.invoke(RestFn.java:421)                                                                                                        
        at clojure.lang.Var.invoke(Var.java:383)                                                                                                              
        at clojure.lang.AFn.applyToHelper(AFn.java:156)                                                                                                       
        at clojure.lang.Var.applyTo(Var.java:700)                                                                                                             
        at clojure.main.main(main.java:37)                                                                                                                    
Caused by: java.net.SocketException: Protocol family unavailable                                                                                              
        at java.net.PlainSocketImpl.socketBind(Native Method)                                                                                                 
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)                                                                            
        at java.net.ServerSocket.bind(ServerSocket.java:375)                                                                                                  
        at java.net.ServerSocket.bind(ServerSocket.java:329)                                                                                                  
        at clojure.tools.nrepl.server$start_server.invokeStatic(server.clj:143)                                                                               
        at clojure.tools.nrepl.server$start_server.doInvoke(server.clj:121)                                                                                   
        at clojure.lang.RestFn.invoke(RestFn.java:619)                                                                                                        
        at user$eval10459.invokeStatic(form-init6590227691248211762.clj:1)                                                                                    
        at user$eval10459.invoke(form-init6590227691248211762.clj:1)                                                                                          
        at clojure.lang.Compiler.eval(Compiler.java:6927)                                                                                                     
        at clojure.lang.Compiler.eval(Compiler.java:6917)                                                                                                     
        at clojure.lang.Compiler.load(Compiler.java:7379)                                                                                                     
        ... 14 more                                                                                                                                           
Subprocess failed

Steps to reproduce the problem

  • Create a fresh new user, log in
  • Clone prelude into ~/.emacs.d
  • Create personal/dummy.el with just a line: (prelude-require-package 'cider) and eval it
  • lein new foo && cd foo
  • emacs src/foo/core.clj
  • M-x cider-jack-in

Environment & Version information

% java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

CIDER version information

I can't launch the repl from emacs to see, but list-packages shows cider at 20170310.735. nREPL seems to be getting pulled as 0.2.12.

Lein/Boot version

Leiningen 2.7.1 on Java 1.8.0_121 OpenJDK 64-Bit Server VM

Emacs version

GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.7) of 2017-02-07

Operating system

Arch Linux, kernel: 4.10.2-1-ARCH
procs: Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz (x8)

Most helpful comment

For anyone else running into this issue, this can be fixed by setting cider-lein-parameters to "repl :headless :host localhost" (the default value is "repl :headless :host ::")

All 7 comments

Figured this out, at least how to get past it. I'd been running my Arch Linux system with ipv6 disabled for hysterical raisins. After enabling it and rebooting, CIDER/nrepl are now working.

You can also change the boot command, btw. It binds to :: by default, but you can always change this to localhost.

Ah, I see. I was wondering what that :: was doing there. Thanks for CIDER etc, btw!!!!

For anyone else running into this issue, this can be fixed by setting cider-lein-parameters to "repl :headless :host localhost" (the default value is "repl :headless :host ::")

This seems to fix the issue, but, can't I default the parameter to localhost for every/any new project I'll create in future.

@darkdefender27 See https://github.com/technomancy/leiningen/pull/2444 I'm trying to switch lein to use the updated version of nREPL that addresses this.

Btw, in case someone's wondering why this was the default see https://dev.clojure.org/jira/browse/NREPL-83 and https://github.com/clojure-emacs/cider/issues/2482

Seems we might change the default again soon, as we might have misunderstood the implications of using ::.

Was this page helpful?
0 / 5 - 0 ratings