Closed MartinDeLaTorre closed 1 year ago
Apparently docker exec java-example ps -e -o pid,command
(returned PID of 1) does not show the same PIDs as CTN_ID=java-example; docker top $CTN_ID
(returned PID of 25706).
I was using 25706 for everything.
Hello, I was trying to follow along Wenfeng's tutorial: https://wenfeng-gao.github.io/post/profile-java-program-with-bcc-tool/
but I ended up getting this error from Line 18 of the final script:
I just don't understand why is says "No such process" when the container is running and the java spring boot app is also running.
I noticed that "tools.jar" was on the classpath (line 18 of Wenfeng's final script). tools.jar was removed in java 9, so I tried downgrading to java 8 to see if that would fix it, but I ran into problems trying to find a way to compile "libperfmap.so" and "attach-main.jar" for java 8, and I ran out of time for today.
Any clues as to why the "No such process" error happens? I was getting the PID by doing: "docker top java-example"
"java-example" is the container for the spring boot application I was trying to profile. You can try it with:
docker run --name java-example --rm --detach martindelatorre/p3-backend
So do I need java 8? I also found a related issue for using java 9+: https://github.com/jvm-profiling-tools/perf-map-agent/issues/42 I was hoping to avoid downgrading because that would mean I would only be able to profile Java 8 applications, and there isn't an easy way to install java 8 with
apt-get
(there used to be a way to useapt-get
to install java 8, but it seems oracle changed some stuff around and now the .deb packages don't work anymore. I thinkyum
might still support java 8 though.)or is there some other reason that the process couldn't be found? or did I just mess up the PID?
Update:
I managed to find a java 8 jdk to build the perf-map-agent, but after building everything with java 8 I still got the same error.
this is what the command evaluates to:
docker exec --user "0":"0" "java-example" bash -c "cd /tmp/perf-map-agent && java -cp /tmp/perf-map-agent/attach-main.jar:/usr/local/openjdk-8/lib/tools.jar net.virtualvoid.perf.AttachOnce 21469"