[MERGE] Improve handling of errors while generating body_stream in HPSS requests and responses

Andrew Bennetts andrew.bennetts at canonical.com
Mon Mar 2 04:37:37 GMT 2009


Rob and I noticed that a faulty body_stream (i.e. one that raises an exception)
in a response caused the test suite to hang, which meant that no error was being
sent to the client.  This patch fixes that, while taking care not to intercept
errors that occur while writing the parts of the body_stream, and not to
intercept KeyboardInterrupt or SystemExit.

In the course of doing that some server-side error serialisation was refactored
out of a method on SmartServerRequestHandler to a global helper function, so
that the body_stream error handling could reuse it.

The client-side logic for serialising body_stream in requests was updated to use
the same idiom; this fixes a minor bug where it previously would have caught
SystemExit and KeyboardInterrupt.  It also fixes a bug where an exception
writing a chunk of the body_stream to the socket (i.e. due to a socket.error)
would have tried writing an error message to the socket!  (Now the error will be
propagated back to the caller of call_with_body_bytes.)

I took care to make sure the serialisation of errors from the server meet the
expectation of the client-side decoder; it does, and now tests for both the
server-serialisation and client-deserialisation use the same string constant to
avoid skew.

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: streaming-body-error-4067.patch
Type: text/x-diff
Size: 18043 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090302/76b547ee/attachment.bin 


More information about the bazaar mailing list