尽管我在root下运行dotnet dump,进程在root下(请参阅下面的服务描述(,但我似乎缺乏一些权限。我还尝试了home、var和tmp中的其他目录:都是相同的消息。
root@DSK06511:/home/monouser# dotnet-dump collect -p 10131 --diag -o /var/tmp/MyNodeDump/
Writing full to /var/tmp/MyNodeDump/
Writing dump failed (HRESULT: 0x80004005)
root@DSK06511:/tmp# dotnet-dump collect -p 10131 --diag -o /home/monorepo/tmp/
Writing full to /home/monouser/tmp/
Writing dump failed (HRESULT: 0x80004005)
服务文件:
root@DSK06511:/home/monouser# cat /etc/systemd/system/MyNode.service
[Unit]
Description=MyNode
[Service]
Type=simple
User=root
Group=root
ExecStart=/home/monouser/.octopus/Applications/OctopusServer/Production/MyNode.Linux/4.0.1.907/MyNode --console
[Install]
WantedBy=multi-user.target
诊断信息:dotnet转储--版本3.1.120604+97218bff6a14e60360862529b09b687789cc1279
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.201/
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
3.1.201 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
操作系统版本NAME="Ubuntu"version="18.04.3 LTS(仿生海狸(">
他们在这里也遇到了类似的问题,但他们用--输出到/tmp中的目录来解决这个问题,这对没有帮助
此外,我将描述docker的情况。
如果你正在使用docker,启动一个有特权的容器可以帮助:
docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash
https://github.com/dotnet/diagnostics/blob/master/documentation/FAQ.md#frequently-提问
请在您的服务目录中检查createdump的权限,它需要执行权限才能工作,如果它看起来像这样:
ls -l | grep 'lib|create'
-rw-rw-rw- 1 root root 109656 May 20 00:40 createdump
您必须授予执行权限:
sudo chmod u+x createdump
当我想在运行AWS ECS的docker容器中运行dotnet-dump
时,我遇到了同样的问题。
我必须启用SYS_PTRACE
linux参数功能。
这就是我在Terraform中必须做的,其中定义了容器定义:
linux_parameters = {
capabilities = {
add = ["SYS_PTRACE"],
drop = null
},
devices = null,
initProcessEnabled = null,
maxSwap = null,
sharedMemorySize = null,
swappiness = null,
tmpfs = null
}