-
Notifications
You must be signed in to change notification settings - Fork 383
Description
Description
I am writing a profiler for dotnet apps. The profiler can attach to a running dotnet process and then detaches by itself after 30 seconds. I am using Microsoft.Diagnostics.NETCore.Client for attaching.
This works well and MacOS and Windows. However, I want this profiler to be able to attach to web services like containerized apps. In practice, that means having two containers:
- A is the app to profile
- B is the app that calls
AttachProfilerusing A's pid through IPC
I have tested this and it works, I am able to attach a native profiler to A this way.
However, when attaching a second time, A crashes (segfault) when B does AttachProfiler. I have no idea why.
Configuration
- Tested with net 6 and net 7.0.100 (both services A and B)
- B references Microsoft.Diagnostics.NETCore.Client 0.2.351802
Other information
Unfortunately, I find it very difficult to debug this segfault because it only happens when running in docker.
Here are the things I have tried:
- Doing the same process but out of docker, where A and B are just two "normal" processes (no containers involved). I have no issue, tested on MacOS ARM64 and Windows 10. For this reason, I think the issue is not in my profiler implementation but rather in the dotnet runtime. I have no idea if this is due to linux OS or IPC between two containers.
- I tested removing everything from my profiler except the attach / detach logic. Issue is still there.
- Using different versions of
Microsoft.Diagnostics.NETCore.Client. It didn't help
I would gladly give your a repro (the profiler is open source) but this issue is quite specific and requires some setup (running 2 containers and following some steps to trigger the AttachProfiler twice until A crashes). Let me know if you want me to detail this.
Otherwise, do you have any idea how I could debug this issue?