Skip to content

error in process filter: [nREPL] Direct connection failed #1945

Closed
@hanshuebner

Description

@hanshuebner

M-x cider-jack-in fails to successfully connect to the leiningen subprocess in some cases. I have been seeing this issue in a long time, on various machines and with a number of cider versions. Sometimes, retrying the M-x cider-jack-in one or a few times helped. Recently, when I was annoyed by this again, I tried to figure out what the problem could be by running telnet localhost <the-port-number> and found that telnet tried to connect to ::1 (ipv6 localhost), getting a "connection refused" message. When I used telnet 127.0.0.1 <the-port-number> however, the connection was accepted. It seems that the nrepl server only listens on ipv4 (maybe by using an explicit 127.0.0.1 address to listen on), but cider uses localhost as host name to connect. Thus, it depends on the local systems' interpretation and name resolution configuration what address cider tries to connect to.

Bozhidar made the very good suggestion that the message could be improved to include information as to what connection actually failed. Something like [nREPL] could not connect to localhost:12345 would already give a hin in what direction one could investigate.

The connection between cider and the nrepl server should use the same host specification, I think. Thus, if nrepl listens on 127.0.0.1 by default, cider should also use 127.0.0.1 and not localhost to avoid mismatches caused by name resolution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions