File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ def cleanup_session(self):
184184 if self .process is None :
185185 return
186186 try :
187- # Reduce grace period from 2 seconds to 0.5
187+ # total grace period = 8 seconds
188188 self .process .terminate ()
189189 self .process .join (timeout = 2 )
190190
@@ -196,12 +196,16 @@ def cleanup_session(self):
196196 if self .process .exitcode is None :
197197 logger .error ("Process refuses to die, using SIGKILL" )
198198 os .kill (self .process .pid , signal .SIGKILL )
199+ self .process .join (timeout = 4 )
199200 except Exception as e :
200201 logger .error (f"Error during process cleanup: { e } " )
201202 finally :
202203 if self .process is not None :
203- self .process .close ()
204- self .process = None
204+ try :
205+ self .process .close () # still try to close
206+ except ValueError :
207+ logger .error ("Skipping close: child stuck in D-state" )
208+ self .process = None
205209
206210 def run (self , code : str , reset_session = True ) -> ExecutionResult :
207211 """
You can’t perform that action at this time.
0 commit comments