From: Haomai Wang Date: Sun, 19 Jun 2016 15:12:10 +0000 (+0800) Subject: test_msgr: add assert if wait for shutdown hang X-Git-Tag: v10.2.3~100^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=af8e86c20e9b1124abe33f0dff58817fc8aad7c9;p=ceph.git test_msgr: add assert if wait for shutdown hang Signed-off-by: Haomai Wang (cherry picked from commit ca22e0bc09c1a13c8dac14b25c00501e912b8006) --- diff --git a/src/test/msgr/test_msgr.cc b/src/test/msgr/test_msgr.cc index b28c7580bc7e..65a6a6fc4991 100644 --- a/src/test/msgr/test_msgr.cc +++ b/src/test/msgr/test_msgr.cc @@ -1018,11 +1018,16 @@ class SyntheticWorkload { } void wait_for_done() { - uint64_t i = 0; + int64_t tick_us = 1000 * 100; // 100ms + int64_t timeout_us = 5 * 60 * 1000 * 1000; // 5 mins + int i = 0; while (dispatcher.get_pending()) { - usleep(1000*100); + usleep(tick_us); + timeout_us -= tick_us; if (i++ % 50 == 0) print_internal_state(true); + if (timeout_us < 0) + assert(0 == " loop time exceed 5 mins, it looks we stuck into some problems!"); } for (set::iterator it = available_servers.begin(); it != available_servers.end(); ++it) {