Skip to content

Commit b9efe7e

Browse files
TimPansinohmstepanek
authored andcommitted
Fix error when shutdown_agent called from harvest thread (#1552)
1 parent 09eaa22 commit b9efe7e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

newrelic/core/agent.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,12 @@ def shutdown_agent(self, timeout=None):
746746
self._harvest_thread.start()
747747

748748
if self._harvest_thread.is_alive():
749-
self._harvest_thread.join(timeout)
749+
try:
750+
self._harvest_thread.join(timeout)
751+
except RuntimeError:
752+
# This can occur if the application is killed while in the harvest thread,
753+
# causing shutdown_agent to be called from within the harvest thread.
754+
pass
750755

751756

752757
def agent_instance():

0 commit comments

Comments
 (0)