diff --git a/python/graphscope/framework/graph.py b/python/graphscope/framework/graph.py index 7e2e32452b97..0f343d120c43 100644 --- a/python/graphscope/framework/graph.py +++ b/python/graphscope/framework/graph.py @@ -288,7 +288,13 @@ def unload(self): self._interactive_instance_launching_thread is not None and self._interactive_instance_launching_thread.is_alive() ): - self._interactive_instance_launching_thread.join() + # join raises a RuntimeError if an attempt is made to join the current thread. + # this exception occurs when a object collected by gc mechanism contains a running thread. + if ( + threading.current_thread() + != self._interactive_instance_launching_thread + ): + self._interactive_instance_launching_thread.join() self._close_interactive_instances() except Exception as e: logger.error("Failed to close interactive instances: %s" % e)