Skip Menu |

This queue is for tickets about the Net-SSH2 CPAN distribution.

Report information
The Basics
Id: 82541
Status: resolved
Priority: 0/
Queue: Net-SSH2

People
Owner: Nobody in particular
Requestors: pwood [...] christianbook.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.33
Fixed in: (no value)



Subject: Cannot configure timeout for auth_publickey
Some methods of Net::SSH2 support a timeout value (namely, poll and connect). However, another situation where a timeout would be valuable is in the auth methods. For example, auth_publickey doesn't have a way to specify a timeout. I'd like to be able to do this, as auth occasionally takes too long and right now it just seems to wait. One recent auth_publickey call took 18.2 seconds to return. I'd like to be able to have it timeout at 2 seconds.
Subject: Re: [rt.cpan.org #82541] Cannot configure timeout for auth_publickey
Date: Mon, 7 Jan 2013 15:37:48 -0500
To: bug-Net-SSH2 [...] rt.cpan.org
From: Rafael Kitover <rkitover [...] gmail.com>
Yeah that sounds reasonable, I'll see if I can do something this weekend. On Monday, January 7, 2013 at 3:34 PM, mtv97rox via RT wrote: Show quoted text
> Some methods of Net::SSH2 support a timeout value (namely, poll and connect). However, > another situation where a timeout would be valuable is in the auth methods. For example, > auth_publickey doesn't have a way to specify a timeout. I'd like to be able to do this, as auth > occasionally takes too long and right now it just seems to wait. One recent auth_publickey call > took 18.2 seconds to return. I'd like to be able to have it timeout at 2 seconds.
On Mon Jan 07 15:34:28 2013, cbdpeter wrote: Show quoted text
> Some methods of Net::SSH2 support a timeout value (namely, poll and > connect). However, > another situation where a timeout would be valuable is in the auth > methods. For example, > auth_publickey doesn't have a way to specify a timeout. I'd like to be > able to do this, as auth > occasionally takes too long and right now it just seems to wait. One > recent auth_publickey call > took 18.2 seconds to return. I'd like to be able to have it timeout at > 2 seconds.
That can be done setting the Net::SSH2 object (say $ssh2) to non-blocking mode and then calling the low level authentication method (i.e. auth_publickey) repeatly until it succeeds, or returns an error that is not LIBSSH2_ERROR_EAGAIN or the timeout expires. The underlaying connection socket can be monitored to avoid busy-waiting. In any case, it is not going to be easy :-(
Fixed in the development version.