Merge lp:~spiv/bzr/hpss-log-noise into lp:~bzr/bzr/trunk-old

Proposed by Andrew Bennetts
Status: Merged
Merged at revision: not available
Proposed branch: lp:~spiv/bzr/hpss-log-noise
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 52 lines
To merge this branch: bzr merge lp:~spiv/bzr/hpss-log-noise
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+8922@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrew Bennetts (spiv) wrote :

The fix has two simple parts:

 * don't log UnknownSmartMethod exceptions from the request handler, as these
   are not exceptional (or particularly interesting) events for the server.

 * don't bother trying to invoke do_chunk or do_end if there is no live command
   in the request handler (e.g. because the request we are parsing is currently
   for an unknown method). Unknown requests should simply be consumed and
   discarded (after sending an UnknownMethod response, of course).

This fixes bug #338561.

-Andrew.

Revision history for this message
Robert Collins (lifeless) wrote :

 review +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-07-16 23:20:23 +0000
3+++ NEWS 2009-07-17 05:35:14 +0000
4@@ -40,6 +40,10 @@
5 committed to will no longer corrupt the dirstate. This was caused by an
6 bug in the dirstate update_minimal method. (Robert Collins, #395556)
7
8+* Requests for unknown methods no longer cause the smart server to log
9+ lots of backtraces about ``UnknownSmartMethod``, ``do_chunk`` or
10+ ``do_end``. (Andrew Bennetts, #338561)
11+
12 * ``WorkingTree4.unversion`` will no longer fail to unversion ids which
13 were present in a parent tree but renamed in the working tree.
14 (Robert Collins, #187207)
15
16=== modified file 'bzrlib/smart/protocol.py'
17--- bzrlib/smart/protocol.py 2009-07-08 07:03:38 +0000
18+++ bzrlib/smart/protocol.py 2009-07-17 05:35:14 +0000
19@@ -897,7 +897,8 @@
20 # We do *not* set self.decoding_failed here. The message handler
21 # has raised an error, but the decoder is still able to parse bytes
22 # and determine when this message ends.
23- log_exception_quietly()
24+ if not isinstance(exception.exc_value, errors.UnknownSmartMethod):
25+ log_exception_quietly()
26 self.message_handler.protocol_error(exception.exc_value)
27 # The state machine is ready to continue decoding, but the
28 # exception has interrupted the loop that runs the state machine.
29
30=== modified file 'bzrlib/smart/request.py'
31--- bzrlib/smart/request.py 2009-06-15 06:47:14 +0000
32+++ bzrlib/smart/request.py 2009-07-17 05:35:14 +0000
33@@ -281,6 +281,9 @@
34
35 def accept_body(self, bytes):
36 """Accept body data."""
37+ if self._command is None:
38+ # no active command object, so ignore the event.
39+ return
40 self._run_handler_code(self._command.do_chunk, (bytes,), {})
41
42 def end_of_body(self):
43@@ -344,6 +347,9 @@
44 self._run_handler_code(self._command.execute, args, {})
45
46 def end_received(self):
47+ if self._command is None:
48+ # no active command object, so ignore the event.
49+ return
50 self._run_handler_code(self._command.do_end, (), {})
51
52 def post_body_error_received(self, error_args):