π OpenHands: AI-Driven Development
Fix: Agent gets stuck in closing and server won't die (#5675)
tofarr5498ca1f8bb7
diff --git a/openhands/server/session/agent_session.py b/openhands/server/session/agent_session.pyindex d405ed7ab4..17bd3c6d1c 100644--- a/openhands/server/session/agent_session.py+++ b/openhands/server/session/agent_session.py@@ -15,6 +15,7 @@ from openhands.runtime.base import Runtime, RuntimeUnavailableErrorfrom openhands.security import SecurityAnalyzer, optionsfrom openhands.storage.files import FileStorefrom openhands.utils.async_utils import call_async_from_sync+from openhands.utils.shutdown_listener import should_continueWAIT_TIME_BEFORE_CLOSE = 300WAIT_TIME_BEFORE_CLOSE_INTERVAL = 5@@ -152,7 +153,7 @@ class AgentSession:async def _close(self):seconds_waited = 0- while self._initializing:+ while self._initializing and should_continue():logger.debug(f'Waiting for initialization to finish before closing session {self.sid}')