Skip to contentSkip to conversation

msgr: Fix crash in policy.throttler->get(message_size) when message_size == 0

PATCH Applied Simone Gotti 2 participants 2 messages Jun 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 msgr: Fix crash in policy.throttler->get(message_size) when message_size == 0

Hi all,

using the unstable branch I noticed that sometimes the various servers and the clients were crashing with this backtrace:

#0  0x00000035d02329a5 in raise () from /lib64/libc.so.6
#1  0x00000035d0234185 in abort () from /lib64/libc.so.6
#2  0x00000035d76be8cd in __gnu_cxx::__verbose_terminate_handler() ()
from /usr/lib64/libstdc++.so.6
#3  0x00000035d76bca56 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x00000035d76bca83 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x00000035d76bcb7e in __cxa_throw () from /usr/lib64/libstdc++.so.6
#6  0x00000000005a4b08 in ceph::__ceph_assert_fail (assertion=0x5ca23c

"c > 0", file=<value optimized out>, line=72, func=<value optimized out>) at common/assert.cc:30
#7 0x0000000000460080 in get (this=0x7fec78001800) at ./common/Throttle.h:72
#8 SimpleMessenger::Pipe::read_message (this=0x7fec78001800) at msg/SimpleMessenger.cc:1751
#9 0x0000000000464265 in SimpleMessenger::Pipe::reader (this=0x7fec78001800) at msg/SimpleMessenger.cc:1499
#10 0x00000000004552ad in SimpleMessenger::Pipe::Reader::entry (this=<value optimized out>) at msg/SimpleMessenger.h:168 #11 0x0000000000467a3a in Thread::_entry_func (arg=<value optimized out>) at ./common/Thread.h:39
#12 0x00000035d0607761 in start_thread () from /lib64/libpthread.so.0 #13 0x00000035d02e14dd in clone () from /lib64/libc.so.6

From what I understand probably the same check for zero size messages done for the messenger->message_throttler.get(message_size) should be done also for the next policy.throttler->get(message_size) or it will trigger the assert(c > 0) in Throttle::get .

Thanks!

Regards,
Simone Gotti

P.S. Sorry but I cannot reply mails for a week as I'll be on vacation.

---
 src/msg/SimpleMessenger.cc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
src/msg/SimpleMessenger.cc +3 -2
index a30e075..c15fa04 100644
@@ -1746,9 +1746,10 @@ Message *SimpleMessenger::Pipe::read_message()
        << messenger->message_throttler.get_max() << dendl;
   uint64_t message_size = header.front_len  + header.middle_len
     + header.data_len;
-  if (message_size)
+  if (message_size) {
     messenger->message_throttler.get(message_size);
-  if (policy.throttler) policy.throttler->get(message_size);
+    if (policy.throttler) policy.throttler->get(message_size);
+  }
 
   // read front
   bufferlist front;
Signature · 1 line
1.7.0.1