Hang at commit time when using sftp or bzr+ssh

Stephen Auyeung stephen at ck12.org
Thu Dec 8 23:23:42 UTC 2011


Cleanup aside, one observation I have is that the connection is not shared across operations. When I committed on the same working tree and branch twice, I saw 2 ssh connections (and 2 processes) being established. Could that connection be cached somewhere and be reused?

Thanks,
Stephen

-----Original Message-----
From: bazaar-bounces at lists.canonical.com [mailto:bazaar-bounces at lists.canonical.com] On Behalf Of Aaron Bentley
Sent: Thursday, December 08, 2011 10:31 AM
To: bazaar at lists.canonical.com
Subject: Re: Hang at commit time when using sftp or bzr+ssh

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

On 11-12-07 02:43 PM, Martin Pool wrote:
> On 8 December 2011 06:29, Stephen Auyeung <stephen at ck12.org>
> wrote:
>> Martin,
>> 
>> I did not explicitly open new ssh transports. Was it done inside 
>> commit? If so, why wasn't the disconnect called?
> 
> OK, I think there is a bug where transports that are automatically 
> opened from a url during an operation like this will not be closed 
> automatically.  It will only be a concrete problem in cases like yours 
> where you have a long lived process opening multiple trees bound to 
> remote locations, but it is worth fixing.  We could add a __del__ 
> method, or have some kind of scope that tells it when to disconnect.

Any time you're thinking about scopes and destructors, it's worth considering using a ContextManager.  The transport itself could implement __exit__()

In order to call __exit__ on the transport, you might need to make Branch also a context manager, but that's actually an idea I've had for some time, in order to implement locking more reliably.  Consider:

with Branch.open_read_locked(path) as branch:
    # transport connection is active, branch is read-locked
    branch.last_revision()
# transport connection is closed, branch is unlocked print "done!"

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

iEYEARECAAYFAk7hAkkACgkQ0F+nu1YWqI0y4ACeINC4ARUIbfopWK7CO729UZrH
imIAnR4JTY3NxQm8SR9nLVKY9KiJKz+0
=63IQ
-----END PGP SIGNATURE-----





More information about the bazaar mailing list