File tree 1 file changed +15
-5
lines changed
Public/Src/Engine/Processes
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -429,6 +429,8 @@ protected override async Task KillAsyncInternal(bool dumpProcessTree)
429
429
{
430
430
// surviving child processes may only be set when the process is explicitly killed
431
431
m_survivingChildProcesses = NullIfEmpty ( CoalesceProcesses ( GetCurrentlyActiveChildProcesses ( ) ) ) ;
432
+ // Before notifying that the root process has exited, kill all ptracerunners to avoid receiving access reports after the communication pipe is closed.
433
+ KillActivePTraceRunners ( ) ;
432
434
await base . KillAsyncInternal ( dumpProcessTree ) ;
433
435
KillAllChildProcesses ( ) ;
434
436
SandboxConnection . NotifyRootProcessExited ( PipId , this ) ;
@@ -499,11 +501,7 @@ public override void Dispose()
499
501
500
502
// If ptrace runners have not finished yet, then do that now
501
503
// Completing the task below will make us kill any leftover PTraceRunner processes
502
- m_ptraceRunnersCancellation . SetResult ( true ) ;
503
- foreach ( var runner in TaskUtilities . SafeWhenAll ( m_ptraceRunners . ToArray ( ) ) . GetAwaiter ( ) . GetResult ( ) )
504
- {
505
- runner . Dispose ( ) ;
506
- }
504
+ KillActivePTraceRunners ( ) ;
507
505
508
506
base . Dispose ( ) ;
509
507
}
@@ -1130,5 +1128,17 @@ async Task<AsyncProcessExecutor> runnerTask(AsyncProcessExecutor runner)
1130
1128
return runner ;
1131
1129
}
1132
1130
}
1131
+
1132
+ private void KillActivePTraceRunners ( )
1133
+ {
1134
+ var ptraceRunners = m_ptraceRunners . ToArray ( ) ;
1135
+ m_ptraceRunners . Clear ( ) ;
1136
+
1137
+ m_ptraceRunnersCancellation . TrySetResult ( true ) ;
1138
+ foreach ( var runner in TaskUtilities . SafeWhenAll ( ptraceRunners ) . GetAwaiter ( ) . GetResult ( ) )
1139
+ {
1140
+ runner . Dispose ( ) ;
1141
+ }
1142
+ }
1133
1143
}
1134
1144
}
You can’t perform that action at this time.
0 commit comments