]> git-server-git.apps.pok.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)
committerLoic Dachary <ldachary@redhat.com>
Wed, 29 Jun 2016 08:19:29 +0000 (10:19 +0200)
Signed-off-by: Haomai Wang <haomai@xsky.com>
(cherry picked from commit ca22e0bc09c1a13c8dac14b25c00501e912b8006)

src/test/msgr/test_msgr.cc

index b28c7580bc7e588dec892cacc69827331c7803de..65a6a6fc49911561441ead3e0d1f53a99f3ef8c9 100644 (file)
@@ -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<Messenger*>::iterator it = available_servers.begin();
          it != available_servers.end(); ++it) {