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

SSHlib freeze during init #55

Open
Volinger opened this issue Jun 17, 2022 · 1 comment
Open

SSHlib freeze during init #55

Volinger opened this issue Jun 17, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Volinger
Copy link

Hello,

I am currently struggling with an issue related to opening of new connection. It happens from time to time, that when I connect from PC to a linux based device, that LabVIEW gets frozen during execution of "Connect" API. After some debugging, I found that this is due to my device losing connection during execution of Connect API. If I disconnect device before this API, Connect API returns error 8146. In this case I can reset SSH connection. However, if I turn the device off during Connect API, call function node gets stuck.

I was checking also network traces and found, that if the device is disconnected before API execution, there is some "Reset acknowledge" reported after some timeout, after which call function node stops and I receive mentioned error. If the communication drops during "Connect" execution, then the message is not sent.

My feeling is that libSSH2 (or LV wrapper), is not handling the situation when connection begins to establish, but is not finished - or at least, if at some very specific time connection drops, message is not sent from the device to my PC and then the connection function gets frozen.

I am using connect function with timeout
image
but unfortunately it seems that in case of error which I face this timeout is not triggered (I saw the function call stuck for hours).

Do you please have any idea, how to tackle this issue?

@volks73 volks73 added the bug Something isn't working label Jun 17, 2022
@volks73
Copy link
Member

volks73 commented Jun 17, 2022

LabVIEW creates the TCP connection. Once the TCP connection has been established, the created "socket" is passed to the libssh2 library through the libssh2lv wrapper library to "elevate" the TCP socket to a SSH channel. The timeout is only used by LabVIEW to establish the TCP connection.

Since you are using the timeout but are in some infinite loop, this indicates to me it is something in the SSH handshake to elevate the TCP socket to a SSH channel within the libssh2 library. You may want to try setting a SSH timeout with the "Session.lvclass::Write Timeout" VI or property before using the "Connect" VI. According to the libssh2 documentation for the libssh2_session_set_timeout function:

By default or if you set the timeout to zero, libssh2 has no timeout for blocking functions.

The toolkit and wrapper library mimic the defaults of the libssh2 library. I think creating a SSH connection/elevating TCP to a SSH channel, is a blocking function. Thus, you are stuck in an infinite loop when the SSH connection fails.

I don't know if the "Connect" VI and underlying libssh2 function uses the timeout and/or if this is something that can only be set after the connection, a.k.a. handshake, process is complete. But, worth a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants