Skip to content

dotnet-dump in container doesn't work due to ptrace restriction #80898

@msallin

Description

@msallin

Hi

We run our containers on AWS EKS, and the platform has forbidden calls to "ptrace".
The image we use is based on the newest version of mcr.microsoft.com/dotnet/aspnet:7.0-alpine.
We made minor adjustments, like installing dotnet-dump beside the application to perform memory dumps in production.

When we run dotnet-dump we get an error.

/tmp $ /diag/dotnet-dump ps
1  xyxyxy

/tmp $ /diag/dotnet-dump collect --process-id 1

Writing full to /tmp/core_20230120_095245
[createdump] Problem suspending threads: ptrace(ATTACH, 1) FAILED Operation not permitted (1)
[createdump] Failure took 0ms

/tmp $

As mentioned in dotnet/docs#20573 (comment) from @shirhatti this should work because the tool should send a signal to the process to dump itself.

sh-4.2$ sysctl kernel.yama.ptrace_scope
kernel.yama.ptrace_scope = 0

However, we see that the collect tries to do a ptrace ATTACH.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Diagnostics-coreclrenhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions