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

ssh_handle_packets blocking issue


Hi,

As I've mentioned here before I've been trying to put together a SSH
server with libssh that does pubkey authentication and X11 forwarding.
Milo has been helping me with this a lot :) I've been using the libssh
off Milo's tree wherein he's implemented server side X11 handling.

I've been trying to debug a situation wherein the X11 forwarding works
on occassion but otherwise mysteriously fails. Approximately the
failure rate would be around 20% and the ssh client shows that the X11
channel is being created. I realized that when it fails the block
occurs after ssh_channel_open_x11 within channel_open and in the call
ssh_handle_packets(session,-1).

Apparently the -1 causes this to block till there is an event. I tried
replacing the -1 with a random number such as 2000 (milliseconds) and
things work much better now....there still is a failure rate with my
X11 forwarding of about 2-5% (from 20%) but there seems to be an
effect.

Of course this was just a random trying to debug approach and I don't
know enough of libssh to know whether the infinite timeout is required
or what the real reason for this behaviour is, truthfully I'm not even
sure if there's something I'm doing in my code that is manifesting in
this error here - don't know what that could be though - only suspect
I have is that in the call to ssh_channel_open_x11 for ip I am
mentioning the ssh server ip and for port the port on which ssh port
listens in for connections (not sure if this is what's supposed to go
in here but seems that these are for logging anyway, but what is truly
expected in these values and if they have an impact is a question I
don't fully understand so thought I'd mention it here in case there's
a link).

I'd truly appreciate your help here since I don't understand the inner
workings of libssh to be able to take it much further on my own - the
random 2 second interval while it works in this case may not be apt in
other situations for e.g. Also it still does fail on occassion even
now.

All the help is truly appreciated. If someone here is interested I
could send across my server code so that maybe people can point out
the bugs :)

Bye for now

ebrain.in
Discover and run software from any device near you.

Follow-Ups:
Re: ssh_handle_packets blocking issueAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org