Skip to content

Commit 9d94073

Browse files
Reverting process invoker logs (#5354)
* Reverting process invoker logs to not log proc object attributes * Minor fix
1 parent b6bf2c4 commit 9d94073

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/Agent.Sdk/ProcessInvoker.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public async Task<int> ExecuteAsync(
338338
afterCancelKillProcessTreeAttemptSignal.Set();
339339
}))
340340
{
341-
Trace.Info($"Process started with process id {_proc?.Id ?? -1}, waiting for process exit.");
341+
Trace.Info($"Process started, waiting for process exit.");
342342

343343
while (true)
344344
{
@@ -373,11 +373,11 @@ public async Task<int> ExecuteAsync(
373373

374374
if (_proc.HasExited)
375375
{
376-
Trace.Info($"Finished process {_proc?.Id ?? -1} with exit code {_proc?.ExitCode ?? -1}, and elapsed time {_stopWatch.Elapsed}.");
376+
Trace.Info($"Finished process and elapsed time {_stopWatch.Elapsed}.");
377377
}
378378
else
379379
{
380-
Trace.Info($"Process _proc.HasExited={_proc?.HasExited ?? false}, Process ID={_proc?.Id ?? -1}, and elapsed time {_stopWatch.Elapsed}.");
380+
Trace.Info($"Process has not exited, elapsed time {_stopWatch.Elapsed}.");
381381
}
382382
}
383383

@@ -460,15 +460,14 @@ internal protected virtual async Task CancelAndKillProcessTree(bool killProcessO
460460
bool gracefulShoutdown = TryUseGracefulShutdown && !killProcessOnCancel;
461461

462462
// Store proc reference locally to prevent race conditions with Dispose()
463-
Process proc = _proc;
464-
ArgUtil.NotNull(proc, nameof(_proc));
463+
ArgUtil.NotNull(_proc, nameof(_proc));
465464

466465
if (!killProcessOnCancel)
467466
{
468467
bool sigint_succeed = await SendSIGINT(SigintTimeout);
469468
if (sigint_succeed)
470469
{
471-
Trace.Info($"Process {proc.Id} cancelled successfully through Ctrl+C/SIGINT.");
470+
Trace.Info($"Process cancelled successfully through Ctrl+C/SIGINT.");
472471
return;
473472
}
474473

@@ -480,12 +479,12 @@ internal protected virtual async Task CancelAndKillProcessTree(bool killProcessO
480479
bool sigterm_succeed = await SendSIGTERM(SigtermTimeout);
481480
if (sigterm_succeed)
482481
{
483-
Trace.Info($"Process {proc.Id} terminate successfully through Ctrl+Break/SIGTERM.");
482+
Trace.Info($"Process terminated successfully through Ctrl+Break/SIGTERM.");
484483
return;
485484
}
486485
}
487486

488-
Trace.Info($"[{proc.Id}] Kill entire process tree with root {proc.Id} since both cancel and terminate signal has been ignored by the target process.");
487+
Trace.Info($"Kill entire process tree since both cancel and terminate signal has been ignored by the target process.");
489488
KillProcessTree();
490489
}
491490

@@ -511,7 +510,7 @@ private async Task<bool> SendSIGTERM(TimeSpan timeout)
511510

512511
private void ProcessExitedHandler(object sender, EventArgs e)
513512
{
514-
Trace.Info($"Exited process {_proc?.Id ?? -1} with exit code {_proc?.ExitCode ?? -1}");
513+
Trace.Info("Exited process");
515514
if ((_proc.StartInfo.RedirectStandardError || _proc.StartInfo.RedirectStandardOutput) && _asyncStreamReaderCount != 0)
516515
{
517516
_waitingOnStreams = true;
@@ -548,7 +547,7 @@ private void StartReadStream(StreamReader reader, ConcurrentQueue<string> dataBu
548547
}
549548
}
550549

551-
Trace.Info($"[{_proc?.Id ?? -1}] STDOUT/STDERR stream read finished.");
550+
Trace.Info($"STDOUT/STDERR stream read finished.");
552551

553552
if (Interlocked.Decrement(ref _asyncStreamReaderCount) == 0 && _waitingOnStreams)
554553
{
@@ -578,15 +577,15 @@ private void StartWriteStream(InputQueue<string> redirectStandardIn, StreamWrite
578577

579578
if (!keepStandardInOpen)
580579
{
581-
Trace.Info($"[{_proc?.Id ?? -1}] Close STDIN after the first redirect finished.");
580+
Trace.Info($"Close STDIN after the first redirect finished.");
582581
standardIn.Close();
583582
break;
584583
}
585584
}
586585
}
587586
}
588587

589-
Trace.Info($"[{_proc?.Id ?? -1}] STDIN stream write finished.");
588+
Trace.Info($"STDIN stream write finished.");
590589
});
591590
}
592591

@@ -606,7 +605,7 @@ private void DecreaseProcessPriority(Process process)
606605
{
607606
if (PlatformUtil.HostOS != PlatformUtil.OS.Linux)
608607
{
609-
Trace.Info($"[{process.Id}] OOM score adjustment is Linux-only.");
608+
Trace.Info($"OOM score adjustment is Linux-only.");
610609
return;
611610
}
612611

@@ -621,7 +620,7 @@ private void DecreaseProcessPriority(Process process)
621620
}
622621
else
623622
{
624-
Trace.Info($"[{process.Id}] Invalid PIPELINE_JOB_OOMSCOREADJ ({userOomScoreAdj}). Valid range is -1000:1000. Using default 500.");
623+
Trace.Info($"Invalid PIPELINE_JOB_OOMSCOREADJ ({userOomScoreAdj}). Valid range is -1000:1000. Using default 500.");
625624
}
626625
}
627626
// Values (up to 1000) make the process more likely to be killed under OOM scenario,

0 commit comments

Comments
 (0)