From df4e134334b1ee74041e912c6e9017830b3b636c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 14 Apr 2016 13:01:36 -0400 Subject: [PATCH] msg/simple/DispatchQueue: inject internal delays in special event dispatch E.g., connection reset. This will help uncover subtle races. Signed-off-by: Sage Weil --- src/msg/simple/DispatchQueue.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/msg/simple/DispatchQueue.cc b/src/msg/simple/DispatchQueue.cc index fed198e4984..be46c360e88 100644 --- a/src/msg/simple/DispatchQueue.cc +++ b/src/msg/simple/DispatchQueue.cc @@ -150,6 +150,15 @@ void DispatchQueue::entry() lock.Unlock(); if (qitem.is_code()) { + if (cct->_conf->ms_inject_internal_delays && + cct->_conf->ms_inject_delay_probability && + (rand() % 10000)/10000.0 < cct->_conf->ms_inject_delay_probability) { + utime_t t; + t.set_from_double(cct->_conf->ms_inject_internal_delays); + ldout(cct, 1) << "DispatchQueue::entry inject delay of " << t + << dendl; + t.sleep(); + } switch (qitem.get_code()) { case D_BAD_REMOTE_RESET: msgr->ms_deliver_handle_remote_reset(qitem.get_connection());