File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,11 @@ async def _initialize_process_based_on_os_type(cmd, env):
253253 return await asyncio .create_subprocess_exec (
254254 * cmd ,
255255 env = env ,
256+ # kernel sporadically ends up cleaning the child matlab-proxy process during the
257+ # restart workflow. This is a workaround to handle that race condition which leads
258+ # to starting matlab-proxy in a new process group and is not counted for deletion.
259+ # https://github.com/ipython/ipykernel/blob/main/ipykernel/kernelbase.py#L1283
260+ start_new_session = True ,
256261 )
257262 except Exception as e :
258263 log .error ("Failed to create posix subprocess: %s" , e )
Original file line number Diff line number Diff line change @@ -153,15 +153,15 @@ def _are_orphaned_servers_deleted(predicate: Optional[str] = "") -> bool:
153153 servers : dict = storage .get_all ()
154154
155155 def _matches_predicate (filename : str ) -> bool :
156- return filename .split ("_" )[0 ] == predicate
156+ return filename .split ("_" )[0 ] == str ( predicate )
157157
158158 # Checks only a subset of servers (that matches the parent_pid of the caller)
159159 # to reduce the MATLAB proxy startup time
160160 if predicate :
161161 servers = {
162162 filename : server
163163 for filename , server in servers .items ()
164- if _matches_predicate (filename )
164+ if _matches_predicate (Path ( filename ). stem )
165165 }
166166 if not servers :
167167 log .debug ("Parent pid not matched, nothing to cleanup" )
You can’t perform that action at this time.
0 commit comments