Rev 4545: (andrew) Fix server log noise when HPSS client calls an unknown smart in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jul 17 08:04:51 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4545 [merge]
revision-id: pqm at pqm.ubuntu.com-20090717070450-mfptrbvfqdenjoui
parent: pqm at pqm.ubuntu.com-20090717002119-7zxzdnednsm818wf
parent: andrew.bennetts at canonical.com-20090717053250-r435uctanwa967se
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-07-17 08:04:50 +0100
message:
  (andrew) Fix server log noise when HPSS client calls an unknown smart
  	method.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
  bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
=== modified file 'NEWS'
--- a/NEWS	2009-07-16 23:20:23 +0000
+++ b/NEWS	2009-07-17 05:32:50 +0000
@@ -40,6 +40,10 @@
   committed to will no longer corrupt the dirstate. This was caused by an
   bug in the dirstate update_minimal method. (Robert Collins, #395556)
 
+* Requests for unknown methods no longer cause the smart server to log
+  lots of backtraces about ``UnknownSmartMethod``, ``do_chunk`` or
+  ``do_end``.  (Andrew Bennetts, #338561)
+  
 * ``WorkingTree4.unversion`` will no longer fail to unversion ids which
   were present in a parent tree but renamed in the working tree.
   (Robert Collins, #187207)

=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2009-07-08 07:03:38 +0000
+++ b/bzrlib/smart/protocol.py	2009-07-17 01:48:56 +0000
@@ -897,7 +897,8 @@
             # We do *not* set self.decoding_failed here.  The message handler
             # has raised an error, but the decoder is still able to parse bytes
             # and determine when this message ends.
-            log_exception_quietly()
+            if not isinstance(exception.exc_value, errors.UnknownSmartMethod):
+                log_exception_quietly()
             self.message_handler.protocol_error(exception.exc_value)
             # The state machine is ready to continue decoding, but the
             # exception has interrupted the loop that runs the state machine.

=== modified file 'bzrlib/smart/request.py'
--- a/bzrlib/smart/request.py	2009-06-15 06:47:14 +0000
+++ b/bzrlib/smart/request.py	2009-07-17 01:47:01 +0000
@@ -281,6 +281,9 @@
 
     def accept_body(self, bytes):
         """Accept body data."""
+        if self._command is None:
+            # no active command object, so ignore the event.
+            return
         self._run_handler_code(self._command.do_chunk, (bytes,), {})
 
     def end_of_body(self):
@@ -344,6 +347,9 @@
         self._run_handler_code(self._command.execute, args, {})
 
     def end_received(self):
+        if self._command is None:
+            # no active command object, so ignore the event.
+            return
         self._run_handler_code(self._command.do_end, (), {})
 
     def post_body_error_received(self, error_args):




More information about the bazaar-commits mailing list