@@ -465,7 +465,7 @@ def _install_exception_hook(cls):
465465 def _handle_unhandled_exception (cls , exc_type , exc_value , exc_traceback ):
466466 """Handle unhandled exceptions by sending telemetry and flushing thread pool"""
467467 logger .debug ("Handling unhandled exception: %s" , exc_type .__name__ )
468-
468+ print ( "Handling unhandled exception: %s" , exc_type . __name__ )
469469 clients_to_close = list (cls ._clients .values ())
470470 for client in clients_to_close :
471471 client .close ()
@@ -530,8 +530,9 @@ def get_telemetry_client(session_id_hex):
530530 @staticmethod
531531 def close (session_id_hex ):
532532 """Close and remove the telemetry client for a specific connection"""
533-
533+ print ( "Closing telemetry client: %s" , session_id_hex )
534534 with TelemetryClientFactory ._lock :
535+ print ("Closing telemetry client, got lock: %s" , session_id_hex )
535536 if (
536537 telemetry_client := TelemetryClientFactory ._clients .pop (
537538 session_id_hex , None
@@ -547,6 +548,8 @@ def close(session_id_hex):
547548 logger .debug (
548549 "No more telemetry clients, shutting down thread pool executor"
549550 )
551+ print ("Shutting down thread pool executor: %s" , session_id_hex )
550552 TelemetryClientFactory ._executor .shutdown (wait = True )
551553 TelemetryClientFactory ._executor = None
552554 TelemetryClientFactory ._initialized = False
555+ print ("Thread pool executor shut down: %s" , session_id_hex )
0 commit comments