Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute ClrHeap.EnumerateRoots stops process with exit code 139 #1234

Open
Ne4to opened this issue Jan 19, 2024 · 1 comment
Open

Execute ClrHeap.EnumerateRoots stops process with exit code 139 #1234

Ne4to opened this issue Jan 19, 2024 · 1 comment

Comments

@Ne4to
Copy link
Contributor

Ne4to commented Jan 19, 2024

I'm trying to inspect a memory dump taken from a process running .NET 7.0.10, macos-arm64 (third party app).
When I try to iterate over ClrHeap.EnumerateRoots() my process exits without throwing any exception.

Console output:

Process finished with exit code 139.

Reproduced on latest Microsoft.Diagnostics.Runtime v3.1.456101 and v3.1.506101 from Azure DevOps public feed.

I tried to debug ClrMD and the process stops at the end of ReadVirtual method.

[UnmanagedCallersOnly]
private static int ReadVirtual(IntPtr self, ulong address, IntPtr buffer, int bytesRequested, int* pBytesRead)
{
DacDataTarget dacDataTarget = ComInterfaceDispatch.GetInstance<DacDataTarget>((ComInterfaceDispatch*)self);
bool result = dacDataTarget.ReadVirtual(address, buffer, bytesRequested, out int bytesRead);
*pBytesRead = bytesRead;
return result ? HResult.S_OK : HResult.E_FAIL;
}

Last variable values:

address = {ulong} 4577698576
buffer = {IntPtr} 0x145116330
bytesRead = {int} 8
bytesRequested = {int} 8
dacDataTarget = DacDataTarget
pBytesRead = {int*} 0x16e13a8ec
result = {bool} true
self = {IntPtr} 0x600002010258

Stack trace:

DacDataTargetCOM.IDacDataTargetVtbl.ReadVirtual() at /Users/ne4to/projects/github.com/Ne4to/clrmd/src/Microsoft.Diagnostics.Runtime/DacInterface/DacDataTargetCOM.cs:line 134
[Managed to Native Transition]
SOSStackRefEnum.Read() at /Users/ne4to/projects/github.com/Ne4to/clrmd/src/Microsoft.Diagnostics.Runtime/DacInterface/SosStackRefEnum.cs:line 54
SOSStackRefEnum.ReadStackRefs()
DacThreadHelpers.<EnumerateStackRoots>d__4.MoveNext()
Enumerable.SelectEnumerableIterator<StackRootInfo, ClrStackRoot>.MoveNext()
Enumerable.WhereEnumerableIterator<ClrStackRoot>.MoveNext()
ClrThread.<CacheAndReturnRoots>d__51.MoveNext()
ClrHeap.<EnumerateRoots>d__91.MoveNext()

<REDACTED>

ThreadPoolWorkQueue.Dispatch()
PortableThreadPool.WorkerThread.WorkerThreadStart()
Thread.StartCallback()
[Native to Managed Transition]

ClrMD is running in a .NET 8 process

dotnet --info output:

.NET SDK:
 Version:           8.0.101
 Commit:            6eceda187b
 Workload version:  8.0.100-manifests.69afb982

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.2
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.101/

.NET workloads installed:
 Workload version: 8.0.100-manifests.69afb982
 [aspire]
   Installation Source: SDK 8.0.100
   Manifest Version:    8.0.0-preview.1.23557.2/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire/8.0.0-preview.1.23557.2/WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.1
  Architecture: arm64
  Commit:       bf5e279d92

.NET SDKs installed:
  6.0.412 [/usr/local/share/dotnet/sdk]
  6.0.414 [/usr/local/share/dotnet/sdk]
  7.0.306 [/usr/local/share/dotnet/sdk]
  7.0.401 [/usr/local/share/dotnet/sdk]
  7.0.403 [/usr/local/share/dotnet/sdk]
  8.0.100 [/usr/local/share/dotnet/sdk]
  8.0.101 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/Users/ne4to/.dotnet]

global.json file:
  /Users/ne4to/projects/github.com/Ne4to/Heartbeat/global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@Ne4to
Copy link
Contributor Author

Ne4to commented Jan 22, 2024

dotnet-dump has the same issue, as I understand it is based on ClrMD

> dotnet-dump --version
8.0.506901+b0ee5b9a01e571161bf772aa659440a986bbe532

> dotnet-dump analyze /Users/ne4to/projects/dbg/dumps/coredump.37588 --command 'dumpheap -stat -live'
Loading core dump: /Users/ne4to/projects/dbg/dumps/coredump.37588 ...
Calculating live objects, this may take a while...
Caching GC roots, this may take a while.
Subsequent runs of this command will be faster.

[1]    43914 segmentation fault  dotnet-dump analyze /Users/ne4to/projects/dbg/dumps/coredump.37588 --command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant