Skip to content

Commit

Permalink
Try to catch memory dump for instrumentation telemetry tests (#6675)
Browse files Browse the repository at this point in the history
## Summary of changes

Try to grab a memory dump if `dotnet build` fails as part of the
instrumentation tests

## Reason for change

Since updating to 9.0.102, we've seen cases of the `dotnet build`
hanging on arm64. In this test we explicitly build a "forwarder" app,
and that has a hung several times in CI now.

## Implementation details

Use the memory dump helper to try to grab a dump. We've only seen this
happen on linux arm64 so far, so haven't bothered to hook up the Windows
monitoring or anything like that

## Test coverage

If the tests pass, that's good enough for me until we see this flake
manifest again.
  • Loading branch information
andrewlock authored Feb 17, 2025
1 parent d2ae16e commit 259d478
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,14 @@ public string GetAppPath(ITestOutputHelper output, EnvironmentHelper environment
RedirectStandardError = true,
};
using var process = new ProcessHelper(Process.Start(startInfo), x => output.WriteLine(x), x => output.WriteLine(x));
process.Process.WaitForExit(30_000);
const int timeoutMs = 30_000;
if (!process.Process.WaitForExit(timeoutMs))
{
var tookMemoryDump = MemoryDumpHelper.CaptureMemoryDump(process.Process, includeChildProcesses: true);
process.Process.Kill();
throw new Exception($"The sample did not exit in {timeoutMs}ms. Memory dump taken: {tookMemoryDump}. Killing process.");
}

process.Drain(15_000);

var extension = EnvironmentTools.IsWindows() ? ".exe" : string.Empty;
Expand Down

0 comments on commit 259d478

Please sign in to comment.