Comment 5 for bug 246233

Revision history for this message
Andrew Bennetts (spiv) wrote :

I can reproduce this.

The problem is that the first thing bzr tries to do with a pull or merge is try to fetch the URL as file in case it is a bundle. If this fails due to being unable to connect (e.g. because SSH auth fails), the ConnectionReset error is intercepted by bzrlib.bundle.read_mergeable_from_transport's "except TransportError" and turned into a NotABundle error. Bzr then continues to try open the URL as a BzrDir, rather than immediately giving up and reporting the connection problem to the user.

There's two problems here, I think. First is that ConnectionReset isn't like the other errors that code wants to catch (e.g. the URL is a directory thus the 'get' fails); the connection is fundamentally broken and unusable, so continuing with the BzrDir opening is the wrong things to do here.

Secondly, if a stream-based smart medium has failed due to ConnectionReset, it should probably keep raising ConnectionReset if some code tries to keep using it, rather than getting into the state that produces the TooManyConcurrentRequests error. Ideally once a medium raises ConnectionReset it should not be used again, but if something does then reraisng ConnectionReset is more useful than TooManyConcurrentRequests.

Fixing the first part of this should be easy, so I'll do that for 1.8.