Too many SSH connections

Bug #516537 reported by Tobi Schäfer on 2010-02-03
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar Plugin for Eclipse
Undecided
Unassigned
bzr-xmloutput
Medium
Unassigned

Bug Description

I am working on a machine running Mac OS X 10.6 with a Bazaar sftp repository in Eclipse using the BzrEclipse plugin 1.1.1.210 from http://verterok.com.ar/bzr-eclipse/update-site/

Even without doing anything I notice more and more SSH connections are being opened until the point where trying to manually open a new shell in Terminal.app results in a “Could not open a new pseudo-tty” error.

I attached a screenshot showing a relatively early stage of the problem. I got hundreds of these processes on peak.

The parent process of these connections is the Python process which itself is child of Eclipse. As I am not aware of any other Python-related plugins in my Eclipse installation I suspect it must be the BzrEclipse plugin.

As I am not an expert with Eclipse plugins or python I would be glad if someone could help me.

Related branches

Tobi Schäfer (interface) wrote :
Guillermo Gonzalez (verterok) wrote :

Hi,

sorry to hear bzr-eclipse isn't working properly for you.

Could you provide more details about your installation?
e.g:
 1) version of bzr-eclipse and bzr
 2) revision/version of bzr-xmloutput
 3) paste the output of 'bzr info <path/to/branch>'

Thanks

Changed in bzr-eclipse:
status: New → Incomplete
Tobi Schäfer (interface) wrote :

version of bzr: 2.0.1

version of bzr-eclipse: 1.1.1.210

version of bzr-xmloutput: 0.8.4

output of bzr info:

Checkout (format: pack-0.92)
Location:
       checkout root: path/to/project
  checkout of branch: sftp://@host.dom/path/to/project/trunk/

Guillermo Gonzalez (verterok) wrote :

Hi p3k,

Apologize the delay,

Your version of bzr-xmloutput is quite old, pleas try updating it to the latest release 0.8.6 or trunk.

Also, this might be related to the issue that's a checkout and not a branch so every operation is opening a ssh connection to the server

Do you have enabled the file test decorator in Preferences -> Team -> Bazaar -> Decorators?

Thanks,

Richard Gruet (rgruet) wrote :

Hi,

I got the same problem with the following configuration:

  - client: Windows XP SP2, bzr 2.0.2, xml-output 0.8.6, Eclipse 3.5, bzr-eclipse 1.1.1.210. "Enable file text decorator" is unchecked (actually only "Enable project text decorator" and "Enable status overlay decorator" are checked).

 - server (where the central repository resides): Redhat, bzr 2.0.3, OpenSSH 4.3p2 x86_64

The branches on the Windows client are checkouts of the central repository via the bzr+ssh protocol..

Several sshd processes are created on the server for each bzr command issued in Eclipse (e.g. Team > update, or just properties > Bazaar info). They look like this (ps aux|grep sshd):
    root 13068 0.0 0.3 88072 3360 ? Ss 14:23 0:00 sshd: root@notty

Example:

Action: Nb ssh processes:
---------- ---------------------------
(start) 2
start Eclipse 11
properties > bzr info 13
update #1 23
update #2 26
exit Eclipse 2

Fortunately the processes *disappear* when I exit Eclipse . I think it was not the case with xml-output 0.8.4 (but I can't be completely positive about it).

When I issue bzr commands directly from a *terminal*, the number of sshd process doesn't increase, so it seems to be a bzr-eclipse + xml-output related problem.

HTH,

Richard

Tobi Schäfer (interface) wrote :

In the meantime I upgraded to xmloutput 0.8.7.dev, but unfortunately the problem remains the same, I am getting flooded by ssh processes.

> Do you have enabled the file test decorator in Preferences -> Team -> Bazaar -> Decorators?

No, I have enabled project text and status overlay decorators only. But there is no difference when I temporarily enabled the file text decorator, anyway.

Raphaël Pinson (raphink) wrote :

We are experiencing the same issue with the following:

Bzr server v. 2.1.0-1 (backport for Debian Etch) with python 2.4

Bzr client/eclipse on Windows XP:
   version of bzr: 2.2.0 and 2.1.1 (two clients)
   version of bzr-eclipse: 1.1.1.210

Romain Chalumeau (rom1-chal) wrote :

I have detected that it is the xmlrpc svr (bzr-xmloutput) that does not free a ssh call once the command done.
Once we kill the rpc svr, the ssh connections are freeed in the remote server. .

I tried to patch the call by modifying the bzr-java-lib to launch the server at each command call and stop it after the result (XMLRPCCommandRunner.java).
It confirms that the connections are well closed, but the performances of the eclipse plugin are really bad.

So i guess that the only solution is to have a look on the rpc code (which i add as affected project).

By the way, the non closure of ssh connections can be reproduced with a direct xmlrpc call (ie without the plugin code) :

debug.py :
  import xmlrpclib
  xml = "http://localhost:1111/RPC2"
  proxy = xmlrpclib.ServerProxy(xml)

  ret = proxy.run_bzr_command( ("/usr/bin/bzr",
                        "push",
                        "bzr+ssh://a_server:a_branch"),
                       "/my_working_tree" )
  print str(ret)

launch the xmlrpc and check in the remote server :

localhost$ bzr start-xmlrpc
a_server$ ps -ef | grep ssh

localhost$ python debug.py
a_server$ ps -ef | grep ssh

Stop the xmlrpc and recheck the connections :

localhost$ bzr stop-xmlrpc
a_server$ ps -ef | grep ssh

Romain Chalumeau (rom1-chal) wrote :

Also reproducible with the xmloutput client.py passing any command to a remote ssh branch.

Romain Chalumeau (rom1-chal) wrote :

So far, a solution is found for Linux only :(

By having the BzrXMLRPCServer inheriting ForkingMixIn class, the bzr calls are done in forks and thus, the connections are closed once done.

Unfortunately, this isn't implemented in Windows. Looking for the windws way...

Romain Chalumeau (rom1-chal) wrote :

Hi,

I have delivered a bugfix working in both windows and linux (available in lp:~rom1-chal/bzr-xmloutput/bugfix-persistent-ssh)
I have used a garbage collector to free the ressources opened by the call to bzrlib.main function :

after the func(argv), the gc.collect() is called to destroy the stored objects and so, to close the distant running bzr

Changed in bzr-xmloutput:
status: New → Fix Committed
Romain Chalumeau (rom1-chal) wrote :

Precision for Windows users :
the SSH client has to be plink set with the env var BZR_SSH = plink

With paramiko (which the mean in the bzr bundle), the distant process (bzr serve --inet) is killed, tbut the ssh ressource is nerver freed by paramiko.

Changed in bzr-xmloutput:
status: Fix Committed → Triaged
Changed in bzr-eclipse:
status: Incomplete → Invalid
Changed in bzr-xmloutput:
importance: Undecided → High
importance: High → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers