From a28196df9af8cb01b0bf39be872e5873e9816e3d Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Sun, 22 May 2016 00:21:19 -0400 Subject: [PATCH 1/2] Version bump to 0.20.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 068b933707bfd5..2550c417b63bce 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ # coding: utf-8 """Constants used by Home Assistant components.""" -__version__ = "0.20.0" +__version__ = "0.20.1" REQUIRED_PYTHON_VER = (3, 4) PLATFORM_FORMAT = '{}.{}' From ceb0ec5fa4b0608564a9e3292591177e79abca95 Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Sat, 21 May 2016 22:35:13 -0400 Subject: [PATCH 2/2] Ignore assertions from python threading when looking for leaked threads. While looking for leaked resources (threads) after shutdown and before restart we in some cases get an assertion in the python threading module where we find a thread marked as running at the python level but it has no associated thread at the C level. --- homeassistant/__main__.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 9494c2a02d159f..ab83d2aa09ad07 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -321,10 +321,18 @@ def try_to_restart(): # Count remaining threads, ideally there should only be one non-daemonized # thread left (which is us). Nothing we really do with it, but it might be # useful when debugging shutdown/restart issues. - nthreads = sum(thread.isAlive() and not thread.isDaemon() - for thread in threading.enumerate()) - if nthreads > 1: - sys.stderr.write("Found {} non-daemonic threads.\n".format(nthreads)) + try: + nthreads = sum(thread.isAlive() and not thread.isDaemon() + for thread in threading.enumerate()) + if nthreads > 1: + sys.stderr.write( + "Found {} non-daemonic threads.\n".format(nthreads)) + + # Somehow we sometimes seem to trigger an assertion in the python threading + # module. It seems we find threads that have no associated OS level thread + # which are not marked as stopped at the python level. + except AssertionError: + sys.stderr.write("Failed to count non-daemonic threads.\n") # Send terminate signal to all processes in our process group which # should be any children that have not themselves changed the process