Skip to content
Advertisement

Analyze memory dump of a dotnet core process running in Kubernetes Linux

I am using Kubernetes in Google Cloud (GKE).

I have an application that is hoarding memory I need to take a process dump as indicated here. Kubernetes is going to kill the pod when it gets to the 512Mb of RAM.

So I connect to the pod

JavaScript

And run:

JavaScript

Find the process I want:

JavaScript

But when I try to dump…

JavaScript

I tried several solutions like these, that always ends in the same result:

JavaScript

I cannot find the way to connect to the pod and deal with this ptrace thing. I found that docker has a --privileged switch, but I cannot find anything similar for kubectl.

UPDATE I found how to enable PTRACE:

JavaScript

Get the process dump:

JavaScript

Funny thing, I cannot find lldb-3.6, so I install the lldb-3.8:

JavaScript

Find SOS plugin:

JavaScript

Run lldb…

JavaScript

But it gets tuck forever, the prompt never gets to (lldb) ever again…

Advertisement

Answer

I had similar issue. Try installing a correct version of LLDB. SOS plugin from specific dotnet version is linked to a specific version of LLDB. For example dotnet 2.0.5 is linked with LLDB 3.6, v.2.1.5 is linked with LLDB 3.9. Also this document might be helpful: Debugging CoreCLR

Note not all versions of LLDB are available for some OS. For example LLDB 3.6 is unavailable on Debian but available on Ubuntu.

Advertisement