-
Notifications
You must be signed in to change notification settings - Fork 358
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
dotnet-dump 0x80004005 on .NET 5 in Linux Docker container #2098
Comments
I've repro'ed the problem using your project/docker file (thanks for that), but I haven't figured what is going yet. If I create a simple container with 5.0 SDK image, create and run a webapp in it, dotnet-dump collect on it works. It seems to be something do with launching in the docker file. I'm going to continue to investigate. |
The conclusion I've come to is that the SYS_PTRACE capability is required for a docker container that launches the app with ENTRYPOINT (I'm sure a pretty common case). Which is pretty much same conclusion the mail thread this issue came from said. The read memory failure is EPERM "Operation not permitted" and it is on app's module header which is critical for createdump to read. I'm not sure what createdump can do to fix this. I don't know enough about docker and linux in this area to come up with any workarounds. /cc: @hoyosjs @shirhatti |
Any ideas what makes .NET Core 3.1 containers different (since dotnet-dump works there)? |
Both 3.1 and 5.0 SDK images have the same Linux kernel version. It must be how they are built. I need to find where we build these images. Anybody know?
Linux cbbede05ce06 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 GNU/Linux
|
Docker uses the OS kernel - that's why the kernel is identical across containers. |
Some further progress here, it looks like this is a regression caused by dotnet/runtime#420, where |
To make it even more fun (read complicated), this depends on the kernel version and the version of docker being used:
And looking at the containerd code, seccomp seems to always disable ptrace there. I don't expect even crashdumps to work under containerd |
kernel'version:3.10.0-957.el7.x86_64 dotnet-dump's version:5.0.221401+2ee978c099e2af7ce69aad0a8c8aabb719fc952d So, this problem will be resolved in version 6.0.0, right? |
It's solved in 5.0.6 as well, and 3.1 had no such issue. The problem is 3.10 is an old kernel, so there's a few things that I am not sure what's going on and I don't expect them to be related to this issue given that you tried SYS_PTRACE. Is this reproducible with any app? It's likely this will have something to do with sidecars and pid-namespace sharing, but this is all conjectures until this gets some more investigation. When you run dump, the verbose flag could give us some pretty useful spew to know where things go south |
Yes, I am running the simplest "hello world" console app in the target container, just like this:
Both my SDK and runtimes use version .NET 5.0.6 In addition, is there any way I can gather more information to help you locate the problem? @hoyosjs |
we solved this by specifying a shared output path between the target container and the sidecar,
|
Description
Running dotnet-dump in a Linux Docker container appears to always require SYS_PTRACE capability to collect dumps now and fails with 0x80004005 without it.
Regression?
Yes. Using dotnet-dump to collect dumps in Linux containers generally worked without any elevated privileges when running on .NET Core 3.1. On .NET 5, however, dump collection fails without SYS_PTRACE.
Other information
Repro steps:
--Diag output looks good at first, but concludes with this error:
If I retarget my app and Dockerfile to netcoreapp3.1, though, the exact same steps work great and I get a dump
Repro code
I've pushed a sample solution to mjrousos/DockerDotnetDumpRepro. In its current state, dotnet-dump fails but after retargeting the csproj and Dockerfile to .NET Core 3.1, dotnet-dump succeeds. Also, a sample Docker image (targeting .NET 5) is available on Dockerhub as mjrousos/dockertest:latest.
The text was updated successfully, but these errors were encountered: