]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test_msgr: add assert if wait for shutdown hang
authorHaomai Wang <haomai@xsky.com>
Sun, 19 Jun 2016 15:12:10 +0000 (23:12 +0800)
committerHaomai Wang <haomai@xsky.com>
Sun, 19 Jun 2016 18:17:49 +0000 (02:17 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/test/msgr/test_msgr.cc

index 891a407a42fce1fb7a4a2f990b2f00ef433cccde..76b975af118a92c9d987ba096179447b795cf061 100644 (file)
@@ -1020,11 +1020,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<Messenger*>::iterator it = available_servers.begin();
          it != available_servers.end(); ++it) {