Bug 826511 - libssh2 returns LIBSSH2_ERROR_EAGAIN in blocking mode
Summary: libssh2 returns LIBSSH2_ERROR_EAGAIN in blocking mode
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libssh2
Version: 6.2
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Karel Srot
Depends On:
Blocks: 834211
TreeView+ depends on / blocked
Reported: 2012-05-30 11:41 UTC by Harald Klein
Modified: 2018-11-28 20:38 UTC (History)
6 users (show)

Fixed In Version: libssh2-1.2.2-11.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2013-02-21 08:42:56 UTC
Target Upstream Version:

Attachments (Terms of Use)
successful run with libssh2-1.2.7 (61.65 KB, text/plain)
2012-05-30 11:44 UTC, Harald Klein
no flags Details
unsuccessful attempt with libsssh2-1.2.2 (27.37 KB, text/plain)
2012-05-30 11:45 UTC, Harald Klein
no flags Details
Net::SSH2 test script (779 bytes, text/x-perl-script)
2012-05-30 11:50 UTC, Harald Klein
no flags Details
backport of upstream commit 697b4e8 (1.30 KB, patch)
2012-05-30 12:44 UTC, Kamil Dudka
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0329 0 normal SHIPPED_LIVE libssh2 bug fix and enhancement update 2013-02-20 20:54:28 UTC

Description Harald Klein 2012-05-30 11:41:50 UTC
Description of problem:

libssh2 returns LIBSSH2_ERROR_EAGAIN in blocking mode when trying to connect with a Perl script using Net::SSH2

Version-Release number of selected component (if applicable):


How reproducible:

Run the provided script

Steps to Reproduce:
1. Install Net::SSH2 (e.g. via CPAN)
2. Run the provided perl script
Actual results:

Unable to exchange encryption keys
Net::SSH2::DESTROY object 0x20474b0

Expected results:


Additional info:

Weird enough the script still works when one would remove the error handling from the connect() call. So even after returning the EAGAIN, the other library calls work fine (auth_publickey(), scp_put()). The script works without flaws on libssh2-1.2.7. Just removing the error handling after connect or ignoring the EAGAIN is not an option as this would affect too many scripts from a 3rd party software, so this is not suitable as a workaround.

I did try to enable tracing but was not able to gather more information from the traces. They're attached.

Comment 1 Harald Klein 2012-05-30 11:44:20 UTC
Created attachment 587702 [details]
successful run with libssh2-1.2.7

this is a trace of libssh2 and the output of the script from a successful run with libssh2-1.2.7

Comment 2 Harald Klein 2012-05-30 11:45:33 UTC
Created attachment 587703 [details]
unsuccessful attempt with libsssh2-1.2.2

this is a trace of libssh2 and the output of the script failing with libssh2-1.2.2

Comment 3 Harald Klein 2012-05-30 11:50:59 UTC
Created attachment 587704 [details]
Net::SSH2 test script

Comment 5 Kamil Dudka 2012-05-30 12:25:39 UTC
Thanks for the reproducer.  git-bisect points to this upstream commit as the fix:


I will need to check whether the fix is applicable on RHEL-6 libssh2 on its own.

Comment 6 Kamil Dudka 2012-05-30 12:44:21 UTC
Created attachment 587718 [details]
backport of upstream commit 697b4e8

Comment 7 Kamil Dudka 2012-05-30 12:46:56 UTC
The attached one-line patch fixes the issue and does not seem to break anything at first glance.  I was able to pass 43 SCP/SFTP tests from rawhide curl against the patched libssh2 library.

Comment 8 Suzanne Yeghiayan 2012-05-30 14:19:16 UTC
This request was evaluated by Red Hat Product Management for inclusion in the
current release of Red Hat Enterprise Linux. Because the affected component is
not scheduled to be updated in the current release, Red Hat is unfortunately
unable to address this request at this time.  It has been proposed for the next

Comment 18 errata-xmlrpc 2013-02-21 08:42:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.