From 2a39e2a8f2a928ded5f76af6a1963d5c0fb6ce76 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Fri, 6 Aug 2021 13:19:47 +0200
Subject: [PATCH] L2SS-271: Made error message more descriptive if thread is
 hanging.

---
 devices/clients/udp_receiver.py             | 3 ++-
 devices/devices/sdp/statistics_collector.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/devices/clients/udp_receiver.py b/devices/clients/udp_receiver.py
index 741474996..cca308cce 100644
--- a/devices/clients/udp_receiver.py
+++ b/devices/clients/udp_receiver.py
@@ -96,7 +96,8 @@ class UDPReceiver(Thread):
         self.join(self.DISCONNECT_TIMEOUT)
 
         if self.isAlive():
-            logger.error("UDP thread not shutting down for {}:{}".format(self.host, self.port))
+            # there is nothing we can do except wait (stall) longer, which could be indefinitely.
+            logger.error(f"UDP thread for {self.host}:{self.port} did not shut down after {self.DISCONNECT_TIMEOUT} seconds, just leaving it dangling. Please attach a debugger to thread ID {self.ident}.")
 
     def __del__(self):
         self.disconnect()
diff --git a/devices/devices/sdp/statistics_collector.py b/devices/devices/sdp/statistics_collector.py
index 4954fd0c3..266eb451c 100644
--- a/devices/devices/sdp/statistics_collector.py
+++ b/devices/devices/sdp/statistics_collector.py
@@ -74,7 +74,8 @@ class StatisticsCollector(Thread):
         self.join(self.DISCONNECT_TIMEOUT)
 
         if self.isAlive:
-            logger.error("Statistics thread not shutting down")
+            # there is nothing we can do except wait (stall) longer, which could be indefinitely.
+            logger.error(f"Statistics thread did not shut down after {self.DISCONNECT_TIMEOUT} seconds, just leaving it dangling. Please attach a debugger to thread ID {self.ident}.")
 
     def process_packet(self, packet):
         """ Update any information based on this packet. """
-- 
GitLab