Skip to content

Can't trace a program running inside docker container by pid or ppid #210

@Abeautifulsnow

Description

@Abeautifulsnow

Description

Hi, before going further, allow me to clarify that maybe this issue seems to be somewhat similar to(not very sure) - Tracing a program running inside docker container may fail #159. Ahh, I've read all the conversations between yours. You've solved the issue metioned by that author. But my situation is a little different from him.

I also have an application running inside the docker container and want to profile it by pid. Through the htop and ps -ef command, I record the pid and parent pid. When I use <austin -Cp> or <austin -p> [pip] to display the stack of the frames it fails.

              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.6.0 [gcc 9.4.0]

Parent process
👽 Not a Python process.

🚼 It looks like you are trying to profile a process that is not a Python
process, and that has not spawned any child Python processes. Make sure that
you are targeting the right application.

Versions

austin: 3.6.0
os:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"

Additional Information

Based on this minor issue, I switched over to py-spy. py-spy is worked for me. It can retrieve the information by the pid and parent pid. - For example, py-spy top -p 22227 will show:

Collecting samples from '/usr/local/bin/python /usr/local/bin/uvicorn energy_api.main:app --host 0.0.0.0 --port 9000' (python v3.8.18)
Total Samples 1623
GIL: 100.00%, Active: 100.00%, Threads: 1

  %Own   %Total  OwnTime  TotalTime  Function (filename)
 39.13%  47.83%    4.16s     4.68s   pslq (mpmath/identification.py)
  0.00%   0.00%    2.86s     2.86s   get_values (pandas/core/internals/blocks.py)
...

I can't put my finger on what the underlying cause is. If I missed something, please let me know. THX.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions