gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
230 stars 21 forks source link

Failed to connect to Snail Server #39

Closed gustavomello9600 closed 3 years ago

gustavomello9600 commented 3 years ago

When calling a REPL from a julia source file, either using C-c C-z or M-x julia-snail, my minibuffer states:

Snail connecting to Julia Process, attemp 1/5...

5 attempts are made and I always end with:

Failed to connect to Snail Server

I've searched through the already closed issues and also the open ones, but haven't found anything similar.

Any ideas on how to solve it?

Information about my setup: Julia 1.04 Emacs 26.3 Ubuntu 19.10 Working vterm installation

gcv commented 3 years ago

With recent versions of Snail, you should see a *julia* buffer pop up once you run julia-snail. That buffer shows the REPL in its vterm. In particular, you should see it print something like this:

julia> JuliaSnail.start(10011);
julia>

Does anything like that happen? Is there even a *julia* buffer created? If it does, and the Julia process starts as expected, and then the Emacs side fails to connect, take a look at your firewall settings. You might be inadvertently blocking the connection (the firewall needs to allow localhost TCP connections on whatever port you want to use for Snail).

If you don't get a *julia* buffer, please check if there's a *julia* process buffer, and see if it has anything interesting. Also, please check for any errors in the *Messages* buffer.

gustavomello9600 commented 3 years ago

Yes, I see the REPL and I am able to interact with it normally. Both *julia* and *julia* process buffers are initialized although the latter remains empty.

Here is all the Snail related content in *Messages* buffer:

Starting Julia process and loading Snail...
Snail connecting to Julia process, attempt 1/5...
Snail connecting to Julia process, attempt 2/5...
Snail connecting to Julia process, attempt 3/5...
Snail connecting to Julia process, attempt 4/5...
Snail connecting to Julia process, attempt 5/5...
if: Failed to connect to Snail server

I am going to do some tests to ensure localhost TCP connections are allowed and report the results back here.

Thanks for your time.

gcv commented 3 years ago

Another thing to check: does Snail connect to the right port? When you go into your project and run julia-snail, the julia-snail-port variable needs to match the call printed on the REPL, i.e., if M-: julia-snail-port returns 10011, then the call to JuliaSnail.start should also be made with 10011.

gustavomello9600 commented 3 years ago

Closing the issue because I've found the problem was that TCP connections were not allowed for my setup of a linux virtual machine. In an appropiate machine, it works just right.

Thank you for the amazing project you are building.

SrAceves commented 3 years ago

@gustavomello9600 I have exactly the same issue; would you mind explaining how you went about allowing TCP connections (in this case)? I know is related to firewall blocking, but don't know how to proceed from there.

btw, I run emacs --daemon and connect to it; when I run a regular emacs instance, julia-snail works.

Much appreciated!