[X2go-dev] x2goclient-cli don't terminates correctly?

Jörg Sawatzki joerg.sawatzki at web.de
Wed Sep 15 04:51:07 CEST 2010


Hi Thomas,

I recently wrote a small python library for the x2go client side stuff
(http://github.com/joerg86/pyx2go) as I had more or less the same issues
that you have. Basically, my idea was to integrate x2go client
functionailty into some USB stick portable environment for schools by
invoking the CLI in the background. I ran into a lot of issues (missing
sshfs/file sharing options, pulseaudio and others) and the cli seemed to
crash/freeze randomly with a lot of zombies left over...
As there's no documentation about x2go's internals available at present
I had to read the sources and got a pretty good feeling for how it
works. My impression of the code is that it is very "hackish" and was
quickly glued together, especially the cli perl stuff: None of the
x2goclients included in the project seem to use an SSH library to handle
connections. They all fork an external OpenSSH process (ssh/ssh.exe) and
control them through command line arguments and pipes. The worst thing
about this is the fact that for EVERY command that is executed on the
server, a separate SSH client is started and a new connection is made.
E.g. list sessions, cancel an existing session, make a new one, run a
command, setup a tunnel for graphic forwarding, setup a tunnel for sound
forwarding - that would fork 6 (!) openssh processes, six connections
and six times auth (which makes the whole thing very SLOW). Some of them
die immediately, some of them keep running and prevent the cli from
exiting. The result is that you have to kill the cli and as the sshs
lost their parent process, they become zombies. 
That's the technical background from my point of view. A quick and dirty
solution would be to fix the perl script to take care of child processes
and properly terminate them at exit. A cleaner solution would be to
rewrite the script to use a proper ssh library, only use ONE connection
and fork no ssh child process at all. 
And well, the third solution is to take the pyx2go stuff - it does not
have these issues as it uses the paramiko python ssh libs and adapt it
to your needs. The only thing is that pyx2go is a python library and
doesn't provide you with a ready to use CLI. If you want to integrate it
into a python program it should be cool, if not, write a small
CLI/wrapper around it. The pulseaudio thing would still need to be
added, but it is an easy peasy tcp port forwarding and some external
processes needing to be started.
I'd be happy to help you with getting this integrated/working and even
write some code and extend the library - as long as your project is
non-commercial/OSS. Otherwise we'd have to agree on some kind of
payment ;)

Hope that helps for now! :o)

Greetings to the capital from small town Lower Saxony (Osnabrück),

Jörg



Am Dienstag, den 14.09.2010, 12:26 +0000 schrieb Thomas T.:
> Hi,
> I have noticed that x2goclient-cli doesn't close all "Childproceses" after I 
> closed/terminated a session.
> If I try to use sound , can't get artsd running properly :/ , there will be 2 
> SSH connections left, else only one SSH connection.
> 
> Example with --use-sound -no :
> 
> ps -A -f
> 
> During running session:
> admin     22945 22534  0 13:53 pts/0    00:00:00 /usr/bin/perl 
> /usr/bin/x2goclient-cli --user oldpc --server 192.168.0.3 --use-sound no --port 
> 22 --command gnome-session 
> admin     22954 22945  0 13:53 pts/0    00:00:00 sh -c DISPLAY=:0 
> SSH_ASKPASS=/home/deka/.x2go/ssh/askpass setsid ssh -p 22 -N -L 
> 30001:localhost:30001 oldpc at 192.168.0.3
> admin     22955 22954  0 13:53 ?        00:00:00 ssh -p 22 -N -L 
> 30001:localhost:30001 oldpc at 192.168.0.3
> admin     22957 22945  0 13:53 pts/0    00:00:00 sh -c LD_LIBRARY_PATH=$X2GO_LIB 
> nxproxy  -S nx/nx,options=/home/deka/.x2go/S-oldpc-50-1284465225/options:50 
> 2>>/home/deka/.x2go/S-oldpc-50-
> admin     22959 22957  0 13:53 pts/0    00:00:00 /usr/lib/x2go/nxproxy -S 
> nx/nx,options=/home/deka/.x2go/S-oldpc-50-1284465225/options:50
> 
> After closing/terminating the session:
> 
> admin 22955 1 0 13:53 ? 00:00:00 ssh -N -L 30001:localhost:30001 
> oldpc at 192.168.0.3
> 
> Starting a new session brings me to
> 
> bind: Address already in use
> channel_setup_fwd_listener: cannot listen to port: 30001
> Could not request local forwarding
> 
> and my System is collecting zombie ssh processes after several sessions ;)
> 
> Is this a small Bug, got any else that Problem or is my fault aka messed up sys 
> config?
> 
> PS: No Problem with qt/gtk x2goclient but I forced to use the cli client and is 
> there a chance for an pulseaudio update for x2goclient-cli?
> 
> Sincerely,
> Thomas, Berlin 14.09.10
> 
> _______________________________________________
> X2go-dev mailing list
> X2go-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/x2go-dev





More information about the x2go-dev mailing list