[MERGE] Fix test suite regression on OSX in TestReadMergeableFromUrl.test_smart_server_connection_reset.

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Oct 1 15:17:05 BST 2008

>>>>> "Andrew" == Andrew Bennetts <andrew at canonical.com> writes:

    Andrew> Vincent Ladeuil wrote:
    Andrew> [...]
    Andrew> Out of interest, what does the stacktrace for the failing test look
    Andrew> like?  I think I can guess, but it'd be good to avoid unnecessary
    Andrew> guesswork :)
    >> Sure:
    Andrew> [...]

    Andrew> Thanks.

    Andrew> [...]
    Andrew> So I think the relevant SmartClientMedium (in this
    Andrew> case SmartTCPClientMedium I guess) should be catching
    Andrew> this error and translating it into something
    Andrew> consistent for the caller, which at the moment would
    Andrew> be to return ''.  So that would mean updating
    Andrew> SmartTCPClientMedium._read_bytes.  (Or
    Andrew> SmartClientHTTPMediumRequest._read_bytes?)
    >> Done in SmartTCPClientMedium. Which leads me to the forgotten
    >> question: in what circumstances is the smart involved in reading
    >> a *bundle* ?

    Andrew> When reading (or attempting to read) a bundle over a
    Andrew> transport that claims to have a smart medium.
    Andrew> E.g. doing “bzr merge bzr://...” or “bzr pull
    Andrew> http://...” will attempt to read a bundle as their
    Andrew> first network operation.

Wow, not the most common usage of a smart server :)

    Andrew> I'm starting to think that the right thing to do
    Andrew> would be to make the medium become responsible for
    Andrew> raising ConnectionReset, rather than the caller of
    Andrew> read_bytes.  This is probably a deeper change than
    Andrew> necessary for fixing this particular bug, so I
    Andrew> wouldn't demand it happen immediately.  But I think
    Andrew> we should be moving in this direction.
    >> And how far should we go there ? 'ConnectionReset', as far as
    >> hpss is concerned can be viewed as a transient error, should we
    >> reconnect automatically (even harder and higher in the stack I
    >> guess) ?

    Andrew> I don't think ConnectionReset should be considered
    Andrew> transient.  If the connection has been refused, or
    Andrew> interrupted, then usually we ought to stop and tell
    Andrew> the user about it.

Well, many users profit from http being robust against transient
errors, but anyway, let's not make that simple patch become a
monster :)


    Andrew> “is” is useful in two cases that I can think of:

    Andrew>   * when you really do want to know if one object is
    Andrew>   the same instance as another.  Use cases are things
    Andrew>   like implementing object serialisers like pickle,
    Andrew>   or maybe caching/memoising mechanisms, or debug
    Andrew>   tools.

    Andrew>   * when being as fast as possible is important, and
    Andrew>   you are *sure* that “is” will give the correct
    Andrew>   answer in this case.


But.. no vote ? :)


More information about the bazaar mailing list