From 95781a31724dfef53b7d3e67721c966d59b3a3b4 Mon Sep 17 00:00:00 2001 From: saibulusu Date: Thu, 24 Jul 2025 12:40:59 -0700 Subject: [PATCH 1/5] Waiting for prime95 process to exit. --- .../VirtualClient.Actions/Prime95/Prime95Executor.cs | 1 + website/docs/workloads/prime95/prime95.md | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs index 36ccb0048a..09e3984368 100644 --- a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs @@ -291,6 +291,7 @@ await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryC { await this.WaitAsync(explicitTimeout, cancellationToken); process.SafeKill(); + await process.WaitForExitAsync(cancellationToken); if (!cancellationToken.IsCancellationRequested) { diff --git a/website/docs/workloads/prime95/prime95.md b/website/docs/workloads/prime95/prime95.md index afe5e371b8..b26d381f36 100644 --- a/website/docs/workloads/prime95/prime95.md +++ b/website/docs/workloads/prime95/prime95.md @@ -41,7 +41,6 @@ The following list describes the measurements captured by the workload running a * Number of Tests passed. * Number of Tests failed. -* Time-to-Compute the Tests (in seconds). ## Workload Metrics The following metrics are examples of those captured by the Virtual Client when running the Prime95 workload. @@ -54,5 +53,4 @@ for which the system was stressed with torture test. A higher the test time with | Metric Name | Example Value (min) | Example Value (max) | Example Value (avg) | Unit | |--------------|---------------------|---------------------|---------------------|------| | failTestCount | 0.0 | 0.0 | 0.0 | | -| passTestCount | 32.0 | 192.0 | 115.45833333333333 | | -| testTime | 3600.0031989 | 3601.679443 | 3600.23347608125 | seconds | \ No newline at end of file +| passTestCount | 32.0 | 192.0 | 115.45833333333333 | | \ No newline at end of file From facf4c2002f08dc5c7ec9926b039103ea4c3493d Mon Sep 17 00:00:00 2001 From: saibulusu Date: Thu, 24 Jul 2025 23:09:00 -0700 Subject: [PATCH 2/5] Add a 5 second wait instead of waiting for the process to finish outright. --- .../VirtualClient.Actions/Prime95/Prime95Executor.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs index 09e3984368..4da709d5a5 100644 --- a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs @@ -291,7 +291,8 @@ await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryC { await this.WaitAsync(explicitTimeout, cancellationToken); process.SafeKill(); - await process.WaitForExitAsync(cancellationToken); + // await process.WaitForExitAsync(cancellationToken); + await Task.Delay(5000); // Wait up to 5 seconds for the process to clean up if (!cancellationToken.IsCancellationRequested) { @@ -303,7 +304,7 @@ await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryC { results = await this.fileSystem.File.ReadAllTextAsync(this.ResultsFilePath); } - + if (string.IsNullOrWhiteSpace(results)) { throw new WorkloadResultsException( From 98cc471b0af6a56acbb91a61372271f401e0deaf Mon Sep 17 00:00:00 2001 From: saibulusu Date: Mon, 28 Jul 2025 15:56:28 -0700 Subject: [PATCH 3/5] Killing entire process tree instead of safe kill. --- .../Prime95/Prime95ExecutorTests.cs | 5 +++++ .../VirtualClient.Actions/Prime95/Prime95Executor.cs | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs b/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs index f2e205c741..13e96738bf 100644 --- a/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs +++ b/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs @@ -198,6 +198,11 @@ public TestPrime95Executor(MockFixture fixture) return base.InitializeAsync(telemetryContext, cancellationToken); } + private Task DelayAsync(TimeSpan delay, CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + public new void Validate() { base.Validate(); diff --git a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs index 4da709d5a5..10ab2c07da 100644 --- a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs @@ -290,9 +290,7 @@ await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryC if (process.Start()) { await this.WaitAsync(explicitTimeout, cancellationToken); - process.SafeKill(); - // await process.WaitForExitAsync(cancellationToken); - await Task.Delay(5000); // Wait up to 5 seconds for the process to clean up + process.Kill(entireProcessTree: true); if (!cancellationToken.IsCancellationRequested) { @@ -312,7 +310,6 @@ await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryC ErrorReason.WorkloadResultsNotFound); } - // The exit code on SafeKill is -1 which is not a part of the default success codes. process.ThrowIfWorkloadFailed(this.successExitCodes); this.CaptureMetrics(process, results, telemetryContext, cancellationToken); } From 2040bea3ae9fa1774ad87fad8714b1f0d6ba41fb Mon Sep 17 00:00:00 2001 From: saibulusu Date: Tue, 29 Jul 2025 14:50:19 -0700 Subject: [PATCH 4/5] Removing delay async from unit test. --- .../Prime95/Prime95ExecutorTests.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs b/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs index 13e96738bf..f2e205c741 100644 --- a/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs +++ b/src/VirtualClient/VirtualClient.Actions.UnitTests/Prime95/Prime95ExecutorTests.cs @@ -198,11 +198,6 @@ public TestPrime95Executor(MockFixture fixture) return base.InitializeAsync(telemetryContext, cancellationToken); } - private Task DelayAsync(TimeSpan delay, CancellationToken cancellationToken) - { - return Task.CompletedTask; - } - public new void Validate() { base.Validate(); From 1e418205862b777cf1e7a330a5c6e1cd2321a551 Mon Sep 17 00:00:00 2001 From: saibulusu Date: Thu, 14 Aug 2025 21:34:47 -0700 Subject: [PATCH 5/5] Using kill() method from ProcessExtensions, still produces 137 error. --- .../VirtualClient.Actions/Prime95/Prime95Executor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs index 10ab2c07da..f0be3be713 100644 --- a/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Prime95/Prime95Executor.cs @@ -8,10 +8,8 @@ namespace VirtualClient.Actions using System.IO; using System.IO.Abstractions; using System.Linq; - using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; - using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using VirtualClient.Common; using VirtualClient.Common.Extensions; @@ -27,6 +25,7 @@ public class Prime95Executor : VirtualClientComponent { private IFileSystem fileSystem; private IPackageManager packageManager; + private ProcessManager processManager; private ISystemManagement systemManagement; private List successExitCodes; @@ -41,6 +40,7 @@ public Prime95Executor(IServiceCollection dependencies, IDictionary(); this.packageManager = this.systemManagement.PackageManager; this.fileSystem = this.systemManagement.FileSystem; + this.processManager = this.systemManagement.ProcessManager; // The exit code on SafeKill is -1 which is not a part of the default success codes. this.successExitCodes = new List(ProcessProxy.DefaultSuccessCodes) { -1 }; @@ -279,7 +279,7 @@ private async Task ExecuteWorkloadAsync(EventContext telemetryContext, Cancellat await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryContext, async () => { - using (IProcessProxy process = this.systemManagement.ProcessManager.CreateProcess(this.ExecutablePath, commandArguments, this.Prime95Package.Path)) + using (IProcessProxy process = this.processManager.CreateProcess(this.ExecutablePath, commandArguments, this.Prime95Package.Path)) { this.CleanupTasks.Add(() => process.SafeKill()); @@ -290,7 +290,7 @@ await this.Logger.LogMessageAsync($"{this.TypeName}.ExecuteWorkload", telemetryC if (process.Start()) { await this.WaitAsync(explicitTimeout, cancellationToken); - process.Kill(entireProcessTree: true); + this.processManager.Kill(new List { process.Name }); if (!cancellationToken.IsCancellationRequested) {