]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: add ms_dump_on_send option
authorSage Weil <sage@inktank.com>
Wed, 2 Apr 2014 15:49:33 +0000 (08:49 -0700)
committerSage Weil <sage@inktank.com>
Sun, 6 Apr 2014 20:19:11 +0000 (13:19 -0700)
This is useful only for debugging.  The encoded contents of a message are
dumped to the log on message send.  This is useful when valgrind is
triggering warnings about uninitialized memory in messages because the
call chain will indicate which message type is to blame, whereas the
usual writer thread context does not tell us any useful information.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/msg/SimpleMessenger.cc

index 6b97c82cfba945a97327eb67b5369c28665f5c0e..ff674cfc19b7e05997eda8ec9246aaccd48f7ced 100644 (file)
@@ -126,6 +126,7 @@ OPTION(ms_inject_delay_msg_type, OPT_STR, "")      // the type of message to del
 OPTION(ms_inject_delay_max, OPT_DOUBLE, 1)         // seconds
 OPTION(ms_inject_delay_probability, OPT_DOUBLE, 0) // range [0, 1]
 OPTION(ms_inject_internal_delays, OPT_DOUBLE, 0)   // seconds
+OPTION(ms_dump_on_send, OPT_BOOL, false)           // hexdump msg to log on send
 
 OPTION(inject_early_sigterm, OPT_BOOL, false)
 
index e11783dd0ab56f3d87acf94c0bf8771b0b8e4090..2070fe591240276bac16c2c51bc0e89627d3db83 100644 (file)
@@ -399,6 +399,19 @@ ConnectionRef SimpleMessenger::get_loopback_connection()
 void SimpleMessenger::submit_message(Message *m, Connection *con,
                                     const entity_addr_t& dest_addr, int dest_type, bool lazy)
 {
+
+  if (cct->_conf->ms_dump_on_send) {
+    m->encode(-1, true);
+    ldout(cct, 0) << "submit_message " << *m << "\n";
+    m->get_payload().hexdump(*_dout);
+    if (m->get_data().length() > 0) {
+      *_dout << " data:\n";
+      m->get_data().hexdump(*_dout);
+    }
+    *_dout << dendl;
+    m->clear_payload();
+  }
+
   // existing connection?
   if (con) {
     Pipe *pipe = NULL;