-
Notifications
You must be signed in to change notification settings - Fork 431
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
There is no /proc/self/ns/mnt in my linux #326
Comments
I think the only place that tries to access /proc/*/ns/mnt is the check to see if we're running in a docker container: Lines 838 to 844 in 107d09a
The rest of file accesses are through /proc/PID/root on linux afaict If the ns/mnt directories don't exist, this check will cause py-spy initialization to fail and the errors you saw =( I think we should change this check to ignore failures, and assume that we aren't running under docker if those folders don't exist |
Don't require /proc/self/ns/mnt to exist on linux, if it doesn't exist just assume that we aren't running in a docker container Closes #326
Don't require /proc/self/ns/mnt to exist on linux, if it doesn't exist just assume that we aren't running in a docker container Closes #326
That last commit should fix - if you want to try it out yourself you can download the wheels from the build artifacts (https://github.com/benfred/py-spy/runs/1729266514) and install py-spy from there. |
I think using the wheels.zip from the build you linked, I get a bit further now. I will have to look as to why it fails this time with: ~/.local/bin/py-spy top --pid 15330 Thanks for the help on this one already. |
Maybe I am running an older kernel, but I even on newer Centos versions it seems there is no namespace folder in the proc filesystem. An earlier comment on issue #49 (#49 (comment)) proposed the second pull request to be used in this case, in stead of using the /proc/self/ns folder to go through the /proc/PID/root folder. That one can be found on my CentOS boxes as well.
Original Pull request:
rbspy/rbspy#74 (comment)
Strace of my issue:
readlink("/proc/30203/exe", "/opt/python-3-dbg/bin/python3.6", 256) = 31
open("/proc/30203/maps", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
read(3, "00400000-00401000 r-xp 00000000 ", 32) = 32
read(3, "08:02 55117221 ", 32) = 32
read(3, " /opt/python-3-dbg/bin/p"..., 64) = 64
read(3, "00001000 08:02 55117221 "..., 128) = 128
read(3, " [heap"..., 256) = 256
read(3, "rw-p 00007000 08:02 28024844 "..., 512) = 512
read(3, " /lib64/libcrypt-2"..., 1024) = 1024
read(3, " /lib64/ld-2.12.so\n3f10a22000-3"..., 2048) = 2048
read(3, "f12000000-3f12015000 r-xp 000000"..., 4096) = 4096
read(3, "0.1\n3f1f00a000-3f1f209000 ---p 0"..., 8192) = 4091
read(3, "7fdf23600000-7fdf24000000 rw-p 0"..., 4101) = 3994
read(3, "7fdf3cd89000-7fdf3cd8c000 rw-p 0"..., 107) = 107
brk(0x1a8c000) = 0x1a8c000
read(3, "b-dynload/_sqlite3.cpython-36dm-"..., 16384) = 4137
read(3, "7fdf3e46d000-7fdf3e46f000 r-xp 0"..., 12247) = 3949
read(3, "7fdf3f657000-7fdf3f65d000 r-xp 0"..., 8298) = 4002
read(3, "7fdf46609000-7fdf4660a000 rw-s 0"..., 4296) = 2720
read(3, "", 1576) = 0
brk(0x1a90000) = 0x1a90000
brk(0x1a97000) = 0x1a97000
brk(0x1aa5000) = 0x1aa5000
close(3) = 0
open("/proc/30203/root/opt/python-3-dbg/bin/python3.6", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFREG|0755, st_size=12681, ...}) = 0
mmap(NULL, 12681, PROT_READ, MAP_SHARED, 3, 0) = 0x7fec28a52000
munmap(0x7fec28a52000, 12681) = 0
close(3) = 0
brk(0x1aa9000) = 0x1aa9000
brk(0x1ab0000) = 0x1ab0000
brk(0x1ab5000) = 0x1ab5000
brk(0x1aba000) = 0x1aba000
readlink("/proc/self/ns/mnt", 0x1ab9c60, 256) = -1 ENOENT (No such file or directory)
write(2, "Error: ", 7Error: ) = 7
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, " (os error ", 11 (os error ) = 11
write(2, "2", 12) = 1
write(2, ")", 1)) = 1
write(2, "\n", 1
) = 1
write(2, "\n", 1
) = 1
It seems that it first goes for the /proc/PID/root folder, but then afterwards it still tries to set the namespace and it fails there.
The text was updated successfully, but these errors were encountered: