Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network IO broken in Julia 1.8.x #120

Closed
gcv opened this issue Apr 25, 2023 · 13 comments
Closed

Network IO broken in Julia 1.8.x #120

gcv opened this issue Apr 25, 2023 · 13 comments

Comments

@gcv
Copy link
Owner

gcv commented Apr 25, 2023

Picking up from #54 (comment) ...

@danielmatz: Can you try this branch? https://github.com/gcv/julia-snail/tree/attempt-io-fix — There are no Elisp changes, so if Git package installation is difficult in your environment, you can just grab the JuliaSnail.jl file and overwrite it wherever Snail is installed. I made a couple of small changes in an attempt to improve network IO robustness that seem to work for me locally, but I'm not exactly a remote REPL power user.

@gcv
Copy link
Owner Author

gcv commented Apr 25, 2023

To clarify, please test with both Julia 1.8 and 1.7 if possible...

@danielmatz
Copy link
Contributor

1.7.2 continues to work as you described in the debug steps.

For 1.8.4, I no longer get the infinite loop. I can see "hello world" printed out at the REPL. But I don't get the IOError: stream is closed or unusable error. And the nc command doesn't exit until I interrupt it.

@gcv
Copy link
Owner Author

gcv commented Apr 25, 2023

So far that’s (new) expected behavior. What about connecting to a remote 1.8.4 instance with Emacs, does that work with the experimental JuliaSnail.el?

@danielmatz
Copy link
Contributor

I can't get snail to connect to a remote instance within Emacs with either 1.8.4 or 1.7.2. I even tried a totally clean config with emacs -Q. With both I get:

Starting Julia process and loading Snail...
if: The vterm buffer is inactive; double-check julia-snail-executable path

@danielmatz
Copy link
Contributor

I tried 1.6.1, and it also doesn't work.

I can try bisecting on julia-snail versions tomorrow.

@gcv
Copy link
Owner Author

gcv commented Apr 26, 2023

Please confirm that julia-snail-executable is set to something that should work. And that vterm works correctly aside from Snail.

@danielmatz
Copy link
Contributor

Yes, I'm setting julia-snail-executable in order to try Julia 1.6.1, 1.7.2, and 1.8.4.

Yes, vterm works correctly otherwise.

I tried a few different versions of snail. I wasn't able to find one that worked, but I did notice something you fixed on your attempt-io-fix branch. On version 1.2.0 of snail, it isn't copying over the files to the remote host successfully:

Copying /Users/dmatz/.emacs.d/straight/build/julia-snail/JuliaSnail.jl to /scpx:fsl:/tmp/julia-snail-ee753ddc21b68d9039842e15ab29ad7b450eb2292303d1cacba96af866b3faec/JuliaSnail.jl...failed
tramp-error: Selecting deleted buffer

This only happens the first time you try. From that point on, it seems that snail sees that the /tmp/julia-snail-* directory exists, and so it doesn't try to copy anything, which I assume leads it to fail when it tries to run JuliaSnail.jl.

On your attempt-io-fix branch, everything copies over properly, but I still get:

Starting Julia process and loading Snail...
julia-snail--repl-enable: The vterm buffer is inactive; double-check julia-snail-executable path

@gcv
Copy link
Owner Author

gcv commented Apr 27, 2023

It looks like launching the remote REPL dies right away. I can't reproduce it on my system.

When you open a Julia source buffer on the remote host using Tramp, you should be able to examine the value returned from this function: (julia-snail--launch-command). The easiest way to look at it is to go into a remote Julia file, add a comment somewhere that contains the expression, like this:

# This is a remote Julia source file. It's opened from the local Emacs instance using Tramp.
# (julia-snail--launch-command)

Place the cursor after the closing parenthesis, and press C-u C-x C-e. That should insert an ssh command, like this:

# (julia-snail--launch-command) "ssh -t -L 10199:localhost:10199 remotehost /home/cv/julia-1.8.5/bin/julia --project=~/myproject -L /tmp/julia-snail-c41a6703d3a802996d2aca8ce6dc5ef057f0c7136e5feacb8b131c449b7ba51f/JuliaSnail.jl"

Now take that string, and paste it into a local shell. It should bring up a remote REPL. Does it do so? If it errors out, what's the error?

@danielmatz
Copy link
Contributor

danielmatz commented Apr 29, 2023

Ah hah! When I run (julia-snail--launch-command), I get nil! Looking at the source, I see that you are checking for the TRAMP connection method to be "ssh", but I typically use "scpx".

See https://www.gnu.org/software/tramp/#Inline-methods and the following section on external methods. There are quite a few variations on using ssh. Perhaps you should be checking for the method to be one of ssh, sshx, rsync, scp, or scpx?

I tested with the ssh method, and I was able to launch a snail repl!

@gcv
Copy link
Owner Author

gcv commented Apr 30, 2023

Nice catch! I just pushed a change to the attempt-to-fix branch that adds scp and scpx connection methods. Could you test it please?

@danielmatz
Copy link
Contributor

Seems like it is working!

@gcv
Copy link
Owner Author

gcv commented May 3, 2023

Great. Normally, I'd let something like this sit in master for a few weeks, but these are important enough bugfixes that I also tagged a version 1.2.1 release. Thanks for helping track these down.

@gcv gcv closed this as completed May 3, 2023
@kadir-gunel
Copy link

Hello @gcv , I am struggling to connect tramp via ssh but I can do sshx without any problems. I searched and configured ton of stuff. And no hope with ssh. I saw above that you added scp and scpx. Is it possible for you to add sshx as well ? Or are there any problems with sshx ?

B.R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants