fix(diag): attach EventPipe observers after client startup

Starting dotnet-counters in the process-creation race can suspend the CLR before the graphical host creates its window. Wait for the guaranteed in-world boundary, then attach counters and contention tracing during the route's warm-up interval.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-24 13:09:24 +02:00
parent 2c874b0977
commit 4285f1dbb1
2 changed files with 12 additions and 1 deletions

View file

@ -351,6 +351,13 @@ public sealed class ConnectedR6SoakContractTests
"RuntimeCounters = if (-not $SkipRuntimeCounters) { $runtimeCounters } else { $null }",
source,
StringComparison.Ordinal);
AssertAppearsInOrder(
source,
"Wait-ForLogPattern $process $stdoutLog 'live: in world'",
"if (-not $SkipRuntimeCounters) {",
"Start-Process -FilePath 'dotnet-counters'",
"if ($CaptureContention) {",
"Start-Process -FilePath 'dotnet-trace'");
}
[Fact]

View file

@ -685,6 +685,11 @@ try {
-RedirectStandardOutput $stdoutLog -RedirectStandardError $stderrLog -PassThru
Write-Marker "launch pid=$($process.Id) commit=$commit session='$env:SESSIONNAME'"
$null = Wait-ForLogPattern $process $stdoutLog 'live: in world' 1 $LoginTimeoutSeconds
# Attach EventPipe observers only after normal CLR/client startup. Starting
# dotnet-counters in the process-creation race can suspend the runtime
# before the graphical host has created a window. The route's 15-second
# warm-up leaves ample time to attach before its first teleport.
if (-not $SkipRuntimeCounters) {
$counterArguments = @(
'collect',
@ -721,7 +726,6 @@ try {
Write-Marker "contention-capture pid=$($traceProcess.Id)"
}
$null = Wait-ForLogPattern $process $stdoutLog 'live: in world' 1 $LoginTimeoutSeconds
# "live: first player position" is a recenter diagnostic, not a session
# boundary: it is intentionally absent when the player's authoritative
# first cell already matches the initial streaming center. The first