You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to connect to a machine running Linux from Windows
import LibSSH as ssh
session = ssh.Session("192.168.80.9"; user="root", log_verbosity=ssh.SSH_LOG_FUNCTIONS)
crashes with
Unhandled Task ERROR: ArgumentError: Passed file descriptor fd=Base.Libc.WindowsRawSocket(0xffffffffffffffff) is not a valid file descriptor
On my system the first two calls to ret = lib.ssh_connect(session_ptr) return SSH_AGAIN. Only after the first call session.fd is a positive number. Does _wait_loop(session) start too early?
And yeah, I could see thread safety being the issue. You could test it by starting Julia with -t 1,0 to only start one thread, or you could try #33 which has improved thread safety.
Interesting 🤔 I'll dig into it more next week. If you're down to have a go yourself, you could try modifying this loop body to notify waiters immediately if the file descriptor is not valid:
Out of curiosity: what was the reason to wrap libssh instead of libssh2 which is shipped by default with Julia?
Libssh is much better documented and has more features (particularly server support) compared to libssh2. In fact, back when I started writing the bindings libssh2 didn't have any API docs at all.
Thank you for working on the issue. Since now it hangs while trying to connect to the Linux system, I tried the demo on the localhost and this too hangs
julia> session = ssh.Session("127.0.0.1", 2222)
[2026/05/09 18:04:50.195600, 3] ssh_config_parse_file: Reading configuration data from C:\Users\nmrsu/.ssh/config
[2026/05/09 18:04:50.197594, 1] ssh_strict_fopen: Failed to open a file C:/ProgramData/ssh/ssh_config for reading: No such file or directory
[2026/05/09 18:04:50.200587, 3] ssh_connect: libssh 0.11.4 (c) 2003-2025 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_pthread
[2026/05/09 18:04:50.203579, 3] getai: host 127.0.0.1 matches an IP address
[2026/05/09 18:04:50.205575, 3] ssh_socket_connect: Nonblocking connection socket: 1228
[2026/05/09 18:04:50.207569, 3] ssh_connect: Socket connecting, now waiting for the callbacks to work
[2026/05/09 18:04:50.208565, 4] ssh_socket_pollcallback: Poll callback on socket 1228 (POLLOUT ), out buffer 0
[2026/05/09 18:04:50.210560, 3] ssh_socket_pollcallback: Received POLLOUT in connecting state
[2026/05/09 18:04:50.211558, 4] socket_callback_connected: Socket connection callback: 1 (0)
[2026/05/09 18:04:50.213552, 3] ssh_client_connection_callback: session_state=2
[2026/05/09 18:04:50.214550, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket
[2026/05/09 18:04:50.215546, 4] ssh_socket_unbuffered_write: wrote 23
[2026/05/09 18:04:50.217542, 3] ssh_connect: current state : 2
I also had to comment out the block in LibSSH.jl starting with @compile_workload begin because the compilation hanged too.
This was on a Windows 10. On a Windows 11, there is no output at all. Can it be that the session is blocked by my organization?
@DeniedPyro, thanks for the report, I closed that issue in favor of keeping everything in this one. I sneakily documented Windows as unsupported in v1 because I couldn't figure it out in time 🙈 I'll have another go this week-ish.
@JamesWrigley: thank you for the work and sorry for joining the party late. On the windows branch, authentication with a private key hangs. Authentication with a password instead works.
Activity
JamesWrigley commentedon Mar 8, 2026
Could you post the full stack trace?
And yeah, I could see thread safety being the issue. You could test it by starting Julia with
-t 1,0to only start one thread, or you could try #33 which has improved thread safety.mzaffalon commentedon Mar 8, 2026
This is with
LibSSH v0.7.1and starting asjulia --project=.mzaffalon commentedon Mar 8, 2026
Starting single threaded did not change anything. On the branch
safety, it hangs heremzaffalon commentedon Mar 8, 2026
Out of curiosity: what was the reason to wrap
libsshinstead oflibssh2which is shipped by default with Julia?JamesWrigley commentedon Mar 8, 2026
Interesting 🤔 I'll dig into it more next week. If you're down to have a go yourself, you could try modifying this loop body to notify waiters immediately if the file descriptor is not valid:
LibSSH.jl/src/session.jl
Line 475 in f80aebe
Libssh is much better documented and has more features (particularly server support) compared to libssh2. In fact, back when I started writing the bindings libssh2 didn't have any API docs at all.
JamesWrigley commentedon May 9, 2026
Could you try again with latest master? I made some more thread safety fixes.
mzaffalon commentedon May 9, 2026
Thank you for working on the issue. Since now it hangs while trying to connect to the Linux system, I tried the demo on the localhost and this too hangs
I also had to comment out the block in LibSSH.jl starting with
@compile_workload beginbecause the compilation hanged too.This was on a Windows 10. On a Windows 11, there is no output at all. Can it be that the session is blocked by my organization?
JamesWrigley commentedon May 19, 2026
Mmm not sure. Seems kinda unlikely if the LibSSH release worked 🤔 (insofar as it didn't hang)
We currently don't test windows on CI, I'll add that and see if I can reproduce it.
JamesWrigley commentedon Aug 5, 2026
@DeniedPyro, thanks for the report, I closed that issue in favor of keeping everything in this one. I sneakily documented Windows as unsupported in v1 because I couldn't figure it out in time 🙈 I'll have another go this week-ish.
JamesWrigley commentedon Aug 11, 2026
Could y'all try the branch in #48? It uses a custom build of libssh that fixes windows support.
DeniedPyro commentedon Aug 11, 2026
@JamesWrigley Looks good on my side! it runs correctly!
mzaffalon commentedon Sep 8, 2026
@JamesWrigley: thank you for the work and sorry for joining the party late. On the
windowsbranch, authentication with a private key hangs. Authentication with a password instead works.JamesWrigley commentedon Oct 18, 2026
Could you try again with v1.2.2? I finally got access to a windows system and was able to fix a segfault in CI.
mzaffalon commentedon Oct 20, 2026
With LibSSH v1.2.2:
Fantastic, thank you!