Error attaching to process in Linux
I am trying to attach to a self-contained .NET 5 process using this command: ./dottrace attach 130121
I receive the following error message:
Can't attach to invalid handle [location] = /opt/buildAgent/work/bb1ab4feb0b2de6d/Profiler/Kernel/Windows/Native/Solution/core/src/Stream/FileNativeStream.cpp(55) [function] = void FileNativeStream::Attach(jb::file_handle &&, const jb::file_access)
Unable to start profiling. Profiler attach failed (HRESULT: 0x80004005).
The same thing happens if I run dottrace with sudo. If I try to start the process using dottrace it does work, but I need to be able to attach to a running process. Any help would be appreciated.
Please sign in to leave a comment.
Hi,
I'm sorry for the delay with the answer.
Is this issue still actual for you? If yes, what Linux distributive are you using?
We have same issue, using mcr.microsoft.com/dotnet/runtime-deps:5.0-buster-slim-amd64 image and netcoreapp3.1 or net5.0 application.
This issue makes impossible for us to use dottrace tool inside linux docker containers.
Hello,
We've checked running dottrace tool with runtime-deps:5.0-buster-slim-amd64 and it works properly in our environment.
Here is the steps which were performed:
1. Run docker:
2. Download dotTrace clt:
3. Unzip clt to the new folder in /root
4. Copy and run .net 5.0 console app in the second console instance (sudo docker exec -it ID /bin/bash)
5. Get process pid (ps -aux) and attach to it from the first console instance via ./dottrace attach <PID>:
Profiler attaches properly and snapshot is saved when app finishes.
"Unable to start profiling. Profiler attach failed (HRESULT: 0x80004005)" error may occur when dottrace and your application is started under different accounts. Currently, dottrace doesn't support cross-user profiling on Linux.
Could you please describe your use case in detail? Maybe you are doing something differently.
Thank you! It is really works under the same user.
Previously we used `nsenter` instead of `docker exec`.