Using pyroscope - phpspy - not a dynamic object
alok87 opened this issue · comments
Pyroscope internally uses phpspy.
Getting this error on hooking to the apache process. Trying this inside a container in Mac. Please suggest what could the issue.
Processes running inside container
/etc # ps -ef
PID USER TIME COMMAND
1 root 0:00 {dumb-init} /usr/bin/qemu-x86_64 /usr/bin/dumb-init /usr/bin/dumb-init --single-child /app/dockerconf/entrypoint.dev.sh
8 root 0:00 {entrypoint.dev.} /usr/bin/qemu-x86_64 /bin/sh /bin/sh /app/dockerconf/entrypoint.dev.sh
192 root 0:00 {httpd} /usr/bin/qemu-x86_64 /usr/sbin/httpd /usr/sbin/httpd -D FOREGROUND
194 apache 0:04 {httpd} /usr/bin/qemu-x86_64 /usr/sbin/httpd /usr/sbin/httpd -D FOREGROUND
196 apache 0:00 {httpd} /usr/bin/qemu-x86_64 /usr/sbin/httpd /usr/sbin/httpd -D FOREGROUND
Running phpspy with Pyroscope
/etc # pyroscope connect --spy-name=phpspy --pid 192
popen_read_line: No stdout; cmd=objdump -Tt /proc/194/exe | awk '/ executor_globals$/{print $1; exit}'
get_symbol_offset: Failed
Running with phpspy directly in container in mac
I also tried installing phpspy manually and calling phpspy with httpd process of apache. Same error.
/phpspy # ./phpspy --limit=1000 --pid=$(pgrep -n httpd)
objdump: /proc/287/exe: not a dynamic object
popen_read_line: No stdout; cmd=objdump -Tt '/proc/287/exe' | awk '/ executor_globals$/{print $1; exit}'
get_symbol_offset: Failed
Will phpspy work in docker for Mac container in mac?
Will phpspy work in docker for Mac container in mac?
It should - the docker containers in Mac run in a Linux VM in the background. The profiled PHP process itself needs to run in a container as well (if it's running on the Mac then it's actually under a different kernel, and the container running phpspy is not "seeing" it, as if it's a different OS).
/phpspy # ./phpspy --limit=1000 --pid=$(pgrep -n httpd)
objdump: /proc/287/exe: not a dynamic object
It seems phpspy is not finding the right binary. It should be aiming at libphp here.
Can you share the following output?
$ sudo cat /proc/$(pgrep -nx httpd)/maps | grep -i libphp
libphp is not there in the output
# cat /proc/$(pgrep -nx httpd)/maps | grep -i libphp
#
Output of cat /proc/$(pgrep -nx httpd)/maps
: https://gist.github.com/alok87/809f034048578dac3d570949cd9d5e5d
Your setup appears to have mod_php named literally "mod_php81.so". While this makes sense, it's non-standard. The library is normally named "libphp*.so". I'll add a flag to support this case.