[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ssh_select possible improvement?


Hi Andreas,

I am able to identity this is the exact commit that introduce the
ssh_select() bug:

http://git.libssh.org/projects/libssh/libssh.git/commit/?h=v0-4&id=22d975a24b69040b28396545e046d2334dd4c386

Vic

On Mon, 2010-09-20 at 23:58 +0800, Vic Lee wrote:
> Hi Andreas,
> 
> I am actually using channel_poll() in other place, but not in this case.
> The reason is that ssh_select() is the only function that can put a
> channel and a normal system file descriptor together in one select()
> call. This way the function will return when either the server side or
> the client side has data, which cannot be done with channel_poll().
> 
> I did some initial analysis on v0-4 branch, and I can confirm that 0.4.4
> is the last release that works fine with ssh_select(); 0.4.5 and later
> (including current latest v0-4 commit) all has this problem. I will try
> to figure it out which commit exactly break the behavior.
> 
> I know that you are moving fast towards 0.5 and avoid changes in 0.4,
> but unfortunately version 0.4.5 got into Debian Squeeze, and Squeeze was
> already freezed, so no way to upgrade to 0.5 for it...
> 
> Anyway, if no one cares about ssh_select(), I guess I am the only one
> left to fix it... :)
> 
> Vic
> 
> On Sun, 2010-09-19 at 19:15 +0200, Andreas Schneider wrote:
> > On Sunday, September 19, 2010 18:38:20 you wrote:
> > > Hi,
> > 
> > Hi Vic,
> > 
> > > Recently I just noticed that when I use libssh to establish a ssh shell
> > > connection to the server, key strokes have a latency. I checked the code
> > > and was able to confirm that this is ssh_select() problem.
> > 
> > well the ssh_select functions is something we ignored for a long time and we 
> > still try to avoid it. It has more bugs than what you describe. I suggest to 
> > use channel_poll() instead.
> > 
> > > The scenario is that: I have a local file descriptor from a terminal pty
> > > (which receives key strokes) and a ssh channel (which receives data from
> > > server). This is a very typical ssh shell session. So I pass the fd and
> > > the channel to ssh_select() with 1 second timeout. However, if I press a
> > > key, ssh_select will not return immediately, but will only return until
> > > the timeout is passed. If I set timeout to 10 seconds, I will get a huge
> > > latency.
> > > 
> > > I am using 0.4.5 (debian squeeze) version, but if you think 0.4.6 could
> > > make any difference, I can try. Please give me some hint before I
> > > actually dig into it. Thanks.
> > 
> > Nobody touched this code since a long time. I think it needs to be rewritten 
> > completely cause it misses a lot of things.
> > 
> > Could you use channel_poll()?
> > 
> > 
> > 	-- andreas
> > 
> > 
> 
> 
> 
> 




Follow-Ups:
Re: ssh_select possible improvement? SOLVED, patch attached.Vic Lee <llyzs@xxxxxxx>
Re: ssh_select possible improvement?Norbert Kiesel <nkiesel@xxxxxxxxxxxxxxx>
References:
ssh_select possible improvement?Vic Lee <llyzs@xxxxxxx>
Re: ssh_select possible improvement?Andreas Schneider <asn@xxxxxxxxxxxx>
Re: ssh_select possible improvement?Vic Lee <llyzs@xxxxxxx>
Archive administrator: postmaster@lists.cynapses.org