Nir Soffer has uploaded a new change for review.

Change subject: vdsm: Fix logging about threads during shutdown
......................................................................

vdsm: Fix logging about threads during shutdown

We used to lie about waiting for threads during shutdown:

    INFO ... VDSM main thread ended. Waiting for 12 other threads...
    INFO ... <Thread(libvirtEventLoop, started daemon 140267893221120)>
    INFO ... <Thread(Thread-10, started daemon 140267122325248)>
    INFO ... <Thread(Thread-3, started daemon 140267659196160)>
    INFO ... <Listener(VM Channels Listener, started daemon 140266683254528)>
    INFO ... <Thread(Thread-9, started daemon 140267608839936)>
    INFO ... <Thread(Thread-8, started daemon 140267617232640)>
    INFO ... <Thread(Thread-7, started daemon 140267625625344)>
    INFO ... <Thread(Thread-6, started daemon 140267634018048)>
    INFO ... <_MainThread(MainThread, started 140268148037440)>
    INFO ... <Thread(Thread-5, started daemon 140267642410752)>
    INFO ... <Thread(Thread-1, started daemon 140267884828416)>
    INFO ... <Thread(Thread-2, started daemon 140267876435712)>
    INFO ... <Thread(Thread-4, started daemon 140267650803456)>

Actually, we are calling stop() on the threads implementing this method,
and we are not waiting for anything. Additionally, the main thread is
logging about itself.

Fix the log to say:

    INFO ... Stopping threads
    INFO ... Stopping <Listener(VM Channels Listener, started daemon 
140127267452672)>
    DEBUG ... <Thread(libvirtEventLoop, started daemon 140128547632896)> is 
still running
    DEBUG ... <Listener(VM Channels Listener, started daemon 140127267452672)> 
is still running
    DEBUG ... <Thread(Thread-1, started daemon 140128539240192)> is still 
running
    DEBUG ... <Thread(Thread-7, started daemon 140128488883968)> is still 
running
    DEBUG ... <Thread(periodic/0, started daemon 140126697010944)> is still 
running
    DEBUG ... <Thread(Thread-6, started daemon 140128497276672)> is still 
running
    DEBUG ... <Thread(Thread-5, started daemon 140128505669376)> is still 
running
    DEBUG ... <Thread(Thread-10, started daemon 140127988864768)> is still 
running
    DEBUG ... <Thread(Thread-8, started daemon 140128005650176)> is still 
running
    DEBUG ... <Thread(Thread-13, started daemon 140126185318144)> is still 
running
    DEBUG ... <Thread(periodic/2, started daemon 140126680225536)> is still 
running
    DEBUG ... <Thread(Thread-3, started daemon 140128522454784)> is still 
running
    DEBUG ... <Thread(Thread-9, started daemon 140127997257472)> is still 
running
    DEBUG ... <Thread(Thread-4, started daemon 140128514062080)> is still 
running
    DEBUG ... <Thread(Thread-2, started daemon 140128530847488)> is still 
running
    DEBUG ... <Thread(periodic/3, started daemon 140126193710848)> is still 
running
    DEBUG ... <Thread(periodic/1, started daemon 140126688618240)> is still 
running
    INFO ... Exiting

Change-Id: I5adefba8b692a8e732903708d8cc5237ca1bbe05
Signed-off-by: Nir Soffer <[email protected]>
---
M vdsm/vdsm
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/61055/1

diff --git a/vdsm/vdsm b/vdsm/vdsm
index 497ecb6..7f9a0e9 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -150,12 +150,18 @@
     except:
         log.error("Exception raised", exc_info=True)
 
-    log.info("VDSM main thread ended. Waiting for %d other threads..." %
-             (threading.activeCount() - 1))
+    log.info("Stopping threads")
     for t in threading.enumerate():
         if hasattr(t, 'stop'):
+            log.info("Stopping %s" % t)
             t.stop()
-        log.info(str(t))
+
+    me = threading.current_thread()
+    for t in threading.enumerate():
+        if t is not me:
+            log.debug("%s is still running", t)
+
+    log.info("Exiting")
 
 
 def install_manhole(locals):


-- 
To view, visit https://gerrit.ovirt.org/61055
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5adefba8b692a8e732903708d8cc5237ca1bbe05
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to