chaosblade icon indicating copy to clipboard operation
chaosblade copied to clipboard

How To Execute JVM Experiment in Docker Container

Open ramgiteng opened this issue 3 years ago • 4 comments
trafficstars

Issue Description

Unable to execute a Chaos Experiement on a Java Process. For example: Attacking CPU/RAM of a Docker container only attacks the container's CPU/RAM

Describe what you expected to happen

Suppose a Docker Container is running a java -jar process. I would like to attack the process's CPU/RAM. Expected: Chaosblade should apply 100% cpu/RAM on the JVM process running inside the container

Describe what happened (or what feature you want)

Feature: Attack the process of the Docker container running Java/NodeJS/(any appllication process)

Tell us your environment

OS Version: CentOS 7.5 Docker Version: 1.13.1

Anything else we need to know?

I am able to mount the chaosblade tool in the /opt directory of the container.

As mentioned above, I am able to use ChaosBlade to inject CPU/RAM on the container running in Docker. How can I perform the same on the Java process? Please let me know if you need further details. Thanks for the support!

ramgiteng avatar Jan 10 '22 18:01 ramgiteng

Please use chaosblade 1.5.0 version. See chaosblade-io/chaosblade-exec-cri#1 for the usage.

xcaspar avatar Jan 11 '22 02:01 xcaspar

Thank you @xcaspar! I will try it out and get back to you.

ramgiteng avatar Jan 11 '22 12:01 ramgiteng

I am facing the following error when I try to run the blade command with the container name and pid 1.

Command: ./blade create cri jvm cpufullload --chaosblade-release ~/chaosblade-1.5.0-linux-amd64.tar.gz --container-name javaapp --pid 1

Response: err: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

I feel that chaosblade is not attaching to the target Java process. Do you have any thoughts on this?

ramgiteng avatar Jan 11 '22 16:01 ramgiteng

Solved by running the command in sudo by entering sudo -i.

When I execute docker run, I am not able to destroy the Delay experiment. I tried "./blade d " inside the container running the Java process but it shows that no such uid exists. @xcaspar Do you have any thoughts about this?

ramgiteng avatar Jan 13 '22 16:01 ramgiteng