Repository navigation
Benchmark process freeze when running DisassemblyDiagnoserTests with xUnit v3 on macos(x64/arm64) #3076
Description
Activity
It seems following
DiagnosticsClient::WriteDumpmethod causing timeout.if (OsDetector.IsMacOS()) { // ClrMD does not support CreateSnapshotAndAttach on MacOS, and AttachToProcess is unreliable, so we have to create a dump file and load it. string dumpPath = Path.GetTempFileName(); try { try { new DiagnosticsClient(processId).WriteDump(DumpType.Full, dumpPath, logDumpGeneration: false); } catch (ServerErrorException sxe) { throw new ArgumentException($"Unable to create a snapshot of process {processId:x}.", sxe); } return DataTarget.LoadDump(dumpPath); } finally { File.Delete(dumpPath); } I don't knows why it cause freeze when benchmark running under xUnit v3.
It sounds like an xUnit or DiagnosticsClient bug. Can you repro with just that code in a test?
Also can you try updating
Microsoft.Diagnostics.NETCore.Client? It looks like the dependent version from ClrMD is quite old now.Could also try the new 4.0.0-beta.26203.1 version of ClrMD.
It can be reproduced with simple console application without using BenchmarkDotNet/xUnit.v3/
dotnet test- https://github.com/filzrev/test_ci_on_macos/blob/main/Benchmarks/Tests.cs#L13-L42
- https://github.com/filzrev/test_ci_on_macos/actions/runs/24135008739
On macos(x64/arm64).
WriteDump method stop processing after outputting following logs.[createdump] 00030bc6 TickFrequency: 1000000 ticks per ms
[createdump] 00030bc6 PAGE_SIZE 4096It might be there is an issue when creating dump self process on macos environment.
Additionally, I've tries following changes, but it seems there is no behavior differences.
- Create dump with
dotnet-dumpcommand. - Try to use WriteDump/WriteDumpAsync methods
- Update ClrMD and
Microsoft.Diagnostics.NETCore.Clientversions - Add
ConfigureAwait(false)
Since you can repro separately, it's clearly an issue with the diagnostics client getting stuck on something from xUnit, nothing we can do here. Please report the bug to dotnet/runtime. You can add a link to the runtime issue in the skip reason.
I've found
createdumpon macos issue is tracked by dotnet/runtime#119945.Dump works as expected when disable AppHost with
<UseAppHost>false</UseAppHost>setting.Though, xunit.v3 requires AppHost existence
It need to skip related benchmarks on macos.Reacted by Tim Cassell
I'm trying to update BenchmarkDotNet tests to use xUnit v3. (#3065)
But DisassemblyDiagnoserTests cause freeze and cause CI timeout(
6h) when running tests with xUnit v3 on macos(x64/arm64)It's not happen on following conditions.
dotnet runcommand onmacosSo I'm suspecting the issue has caused by SynchronizationContext(xUnit/BenchmarkDotNet) related problem,
But I don't have any proof.
Minimum reproduceable example code
https://github.com/filzrev/test_ci_on_macos