Do you need to close a branch? (if so how)

Nicholas Allen nick.allen at onlinehome.de
Wed Feb 25 11:14:21 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You may encounter some variation of the problem but it's hard to
> tell without a high level description of what your code is doing.
> 
> Are you polling the branches ? 

Yes. My code looks like this:

     for branch_emailer in branch_emailers.values():
            branch = branch_emailer._branch

            # Pull from parent if this is desired.
            if config.pull_from_parent:
                try:
                    parent_location = branch.get_parent()
            	
                    if not parent_location is None:
                        parent_branch = Branch.open(parent_location)

                        try:
                            branch.pull(parent_branch)
                        finally:
                            del parent_branch
                except BzrError, e:
                    print >>sys.stderr, \
                            'Could not pull from parent for branch %s:
%s' % (branch_emailer.path, e)

            # Finally send emails for this branch.
            branch_emailer.send_emails()

        time.sleep(config.poll_interval)

> 
> If that's the case, you may want to look at the
> possible_transports parameter in Branch.open.
> 
>     Nicholas> It manages to bring my server to its knees in less
>     Nicholas> than 15 minutes though so it's quite annoying!
> 
>     Nicholas> Any idea what this could be?
> 
> As Robert said, there should some objects accumulating
> somewhere.Specifically that's transport objects you're looking
> after here, more than branches that hold references to some
> transport.
> 
> Have you tried some 'lsof -p <pid>' while your code is running ?

It shows that the sockets are still open. I've seen this with "netstat
- -tp" as well.

I don't keep a reference to the parent branch. Each time round the loop
I open the parent branch and delete it with del parent_branch. So I
don't know how I could be accumulating objects.

Cheers,

Nick
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmlKAoACgkQ1+i51gqqEGmqYwCfXZQqd3Ykna4dS3hPzpUa1rn4
5I4AnAlibyyyWCcD6MPbEN2vJeg/K93x
=PEuc
-----END PGP SIGNATURE-----



More information about the bazaar mailing list