Bug 826511 - libssh2 returns LIBSSH2_ERROR_EAGAIN in blocking mode
libssh2 returns LIBSSH2_ERROR_EAGAIN in blocking mode
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libssh2 (Show other bugs)
x86_64 Linux
high Severity high
: rc
: ---
Assigned To: Kamil Dudka
Karel Srot
: EasyFix, Patch, ZStream
Depends On:
Blocks: 834211
  Show dependency treegraph
Reported: 2012-05-30 07:41 EDT by Harald Klein
Modified: 2013-02-21 03:42 EST (History)
6 users (show)

See Also:
Fixed In Version: libssh2-1.2.2-11.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-02-21 03:42:56 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0329 normal SHIPPED_LIVE libssh2 bug fix and enhancement update 2013-02-20 15:54:28 EST

  None (edit)
Description Harald Klein 2012-05-30 07:41:50 EDT
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 07:44:20 EDT
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 07:45:33 EDT
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 07:50:59 EDT
Created attachment 587704 [details]
Net::SSH2 test script
Comment 5 Kamil Dudka 2012-05-30 08:25:39 EDT
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 08:44:21 EDT
Created attachment 587718 [details]
backport of upstream commit 697b4e8
Comment 7 Kamil Dudka 2012-05-30 08:46:56 EDT
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 10:19:16 EDT
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 03:42:56 EST
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.