-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create from SCP Receive.vi: "Memory Allocation Error - Unable to allocate memory, most likely the system is out of memory." #36
Comments
The LIBSSH2_CHANNEL* inner = libssh2_scp_recv2(session->inner, path, file_info->inner);
if (inner == NULL) {
return LV_LIBSSH2_STATUS_ERROR_MALLOC;
} However, according to the documentation for the
and there are three possible errors: The above C wrapper code in the I will add an issue to the libssh2lv project to update the error handling. However, this is not the cause of your (@ngblume) issue but a complicating factor which is indicating a memory allocation error but really it is most likely a SCP Protocol error based on your description of conditions when running with two other servers. Unfortunately, the HTML documentation for the If it is in fact a It is also possible that the error is a Some additional debugging:
|
If I understand you correctly, I'm not necessarily chasing a memory allocation issue, but it might be one of three options, right?
Would a memory error nevertheless be on server or client-side? Assuming, and I think your assumption here is justified, that my error is actual a "LIBSSH2_ERROR_SCP_PROTOCOL" error, I will try looking into the SSH logs on the servers in more detail. As of now, I was only able to find the connection, authentification and disconnect log entries (Doing disconnect even if transfer fails might be something good for examples as well, because otherwise the server needs to cleanup the left open sessions > reported as new issue #39 for improvement). Regarding error "LIBSSH2_ERROR_EAGAIN": I just used the example, which would be a no for non-blocking IO... Regarding your questions:
Thanks for the help! Cheers |
Debugging-Addition:
|
There is the Read-Execute-Print-Loop with a Raspberry Pi example. It may not be available in the current release on VIPM.io, but you should be able to clone this repository's main branch, i.e. Thank you for the version output. To summarizes and confirm:
What is the client host, a desktop/laptop, RPi, PXI controller, or cRIO?
By "local" do you mean a Local Area Network (LAN), i.e. sitting next to the client host connected either by a (managed) switch or cross-over cable, and by "remote" you mean a Wide Area Network (WAN), possibly even in a different office, building, city, country, etc., and must go through your organization's IT-managed network to the Internet? I am trying to narrow down if your issue is specific to the SCP command, the LabVIEW code, the libssh2 C library, or a network issue with your servers. While this package is far from perfect and I greatly appreciate the bug notifications and feature request from you, I am leaning towards a network/connectivity issue with your servers and the VPN might have something to with it. The difficulty with remote/VPN servers and the delays all indicate some network configuration issue rather than something amiss with the code. Are you using IP addresses for the host addresses or hostnames or Fully-Qualified Domain Names (FQDN)? For example, if connecting from the client with the command line tools, # IP addresses
ssh -vvv niels@192.168.1.5
# Hostnames/mDNS
ssh -vvv niels@raspberrypi.local
# or
ssh -vvv niels@raspberrypi
# FQDNs
ssh -vvv niels@your.organization.com Is IPv6 enabled and being used instead of IPv4? Sometimes I have had issues if IPv6 is enabled with some embedded hardware and network connectivity. There is an overall trend to move away from SCP and use SFTP instead. See (i) What's the difference between SFTP, SCP, and FISH protocols and (ii) OpenSSH 8.0 Release Notes. For your use case, can you use SFTP instead of SCP? The LIBSSH2-LabVIEW package supports the entire SFTP API implemented in the libssh2 library. There are examples for transferring files using SFTP: I believe SFTP uses the same port as SSH and the OpenSSH server does support the SFTP protocol. You should not have to change anything on the remote servers or enable through your IT department. If the SFTP-related Examples and/or VIs work with the remote servers, then it is something with the SCP-related implementation. However, if the SFTP-related Examples and/or VIs yield similar results, then this would be more evidence that it is something with the connectivity/networking/VPN. |
I will try to look at it more closely, but it seems, that the example pretty much does what I included in my test VI already regarding commands / buffers passed back and forth.
The client is a Windows host, the targets are some servers (1 RPi, rest: rack server)...
yes, local means LAN across my WiFi router...
I tried FQDN, as well as IPs..
not sure, need to check... but I think the LAN is IPv6 (mostly) and WAN ist mostly IPv4..
Sounds like a good idea.. Update: Is there a way to change the underlying lib to a more "chatty" one that might give a more detailled view as what to might be wrong? Thanks ! Cheers |
It is missing from v1.1.1, but it is available in the
There is the |
Yes, I think I have encountered this problem before. Please see #30. While it is quite long, towards the end is some information about the splash screen contents being displayed when connecting, i.e. the welcome message (#30 (comment)). There is not a specific resolution to the issue, but it sounds like it is the exact same problem you are encountering. If it is the same problem, then I wonder if you could disable the splash/welcome message on the SSH servers? This way you would avoid having to read the variable/unknown length message before starting and needing a timeout? |
@ngblume I have created a new release, v1.2.0. The new release should include many of the fixes mentioned in this issue and other places, but I don't think it directly resolves this issue. It does include the new shared libraries with the fix for appropriate error messages/codes, so maybe you can install the new release and see if the error code is in fact a SCP protocol error instead of the Out-of-Memory (OOM) error. |
@volks73 Just downloaded it, will install and report back... Cheers |
@volks73 Within Connect.vi: For now, I will revert to previous version (V1.1.1.25) and check if ti works there as before. Anything I'm missing here? Cheers |
@ngblume The Error 56 is caused by the |
I just fixed Error 56 with 895b6fc. The Error 1097 is difficult to resolve at the moment. It appears to occur after running the VIs a second time. The first time I try an example or test, everything works great. When I re-run the same Example or Test, I will get the Error 1097, which is related to the Call Library Function node and the external shared library (DLL on Windows). There might be something wrong with the shared library (v0.2.2). |
@volks73 On the other hand, if I change servers between calls, the error is gone and replaced by the error 56 again.... ===
=== Not very familiar with the debug output, but it seems that there is an issue with the connector.. It might also be an option that the Disconnect.vi is actually causing the problem by leaving some stuff "unclosed"... Cheers |
@volks73 This means for me:
I think the memory allocation error issue is resolved, apart from the 1097 error, which kind of makes the lib hardly usable at the moment... Cheers |
When using the "Create from SCP Receive.vi" (for example within the SCP Download example), I get a "Memory Allocation Error" (-8102) at the Call Library Node (Function: lv_libssh2_scp_receive).
The problem is that this occurs only with some servers, not all and not at all times.
Working locally with an RPi works 100% of the time without problems.
Working with 2 other servers, I get this error 8 out of 10 times (roughly).
Thanks !
Cheers
Niels
The text was updated successfully, but these errors were encountered: