I am currently working on getting the CPU footprint from AcmeAir monolithic application: https://github.com/blueperf/acmeair-monolithic-java
I have correctly setup the webapp and database and it can normally function in a docker container.
Normally If I run this command inside the container:
/opt/java/openjdk/bin/java -javaagent:/opt/ol/wlp/bin/tools/ws-javaagent.jar -Djava.awt.headless=true -Djdk.attach.allowAttachSelf=true --add-exports java.base/sun.security.action=ALL-UNNAMED --add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED --add-exports jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED --add-exports java.security.jgss/sun.security.krb5.internal=ALL-UNNAMED --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED --add-opens java.naming/javax.naming=ALL-UNNAMED --add-opens java.rmi/java.rmi=ALL-UNNAMED --add-opens java.sql/java.sql=ALL-UNNAMED --add-opens java.management/javax.management=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.desktop/java.awt.image=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED --add-exports java.base/jdk.internal.vm=ALL-UNNAMED -jar /opt/ol/wlp/bin/tools/ws-server.jar defaultServer
The server will properly boot up and function normally.
However, when I attach PIN onto the process, the server stop function normally.
I have tried three approach:
- Use PIN as entrypoint. I overwrite the entrypoint using
docker-compose.override.yml
to force the java program to start with my script. Here is the docker-compose file:
acmeair-db:
container_name: acmeair-db
image: mongo:4.0.0
net: ${NETWORK}
privileged: true
acmeair-monolithic-java:
container_name: acmeair-monolithic-java
dockerfile: Dockerfile
net: ${NETWORK}
entrypoint: ./startup-pin.sh
build: .
ports:
- "80:9080"
environment:
- MONGO_HOST=acmeair-db
volumes_from:
- acmeair-db
mem_limit: 1024m
privileged: true
And here is my starting script:
#!/bin/bash
/pin-gcc-linux/pin -t /pin-gcc-linux/source/tools/ManualExamples/obj-intel64/proccount.so -- /opt/java/openjdk/bin/java -javaagent:/opt/ol/wlp/bin/tools/ws-javaagent.jar -Djava.awt.headless=true -Djdk.attach.allowAttachSelf=true --add-exports java.base/sun.security.action=ALL-UNNAMED --add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED --add-exports jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED --add-exports java.security.jgss/sun.security.krb5.internal=ALL-UNNAMED --add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED --add-opens java.naming/javax.naming=ALL-UNNAMED --add-opens java.rmi/java.rmi=ALL-UNNAMED --add-opens java.sql/java.sql=ALL-UNNAMED --add-opens java.management/javax.management=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.desktop/java.awt.image=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED --add-exports java.base/jdk.internal.vm=ALL-UNNAMED -jar /opt/ol/wlp/bin/tools/ws-server.jar defaultServer
There will be trace out, but the server is not functioning normally at all. Most of the services are down and I can't access the server log as well.
- I tried to attach the PID to PIN like:
/pin-gcc-linux/pin -pid <PID> -t /pin-gcc-linux/source/tools/ManualExamples/obj-intel64/proccount.so
If I attach it from host to container, it will say:
A: /tmp_proj/pinjen/workspace/pypl-pin-nightly/GitPin/Source/pin/base_l/sysfuncs_linux.cpp: GetProcessName: 107: assertion failed: p
Which is an error I can not find at anywhere.
If I attach it from within the container, it won't crash but will stall and do nothing. It also prints no output.
I would like to know how can Intel PIN work with Java server, and any direction and help will be appreciated. Thank you!