How Chaos Mesh Injects JVM Faults into Non-Root User Java Processes

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: chaos mesh 如何对非root用户java进程注入jvm故障

| username: TiDBer_YNzCG6n8

Failed to apply chaos: rpc error: code = Unknown desc = com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file
Based on the answers to similar issues found online, it is initially determined that the chaos mesh daemon process is started by the root user, but the application container process inside the pod is started by a non-root user.
However, the current issue is that due to production and other factors, the application container process inside the pod cannot be changed to start as the root user. Therefore, I would like to consult if there is a solution for this in the chaos mesh project?
I previously tried chaos blade and did not seem to encounter similar issues. Is it because of different implementation methods?

| username: yiduoyunQ | Original post link

Submit an issue, please provide the reproduction steps.

| username: zhh_912 | Original post link

Ensure that non-root users have sufficient read and write permissions for the resources required by the Chaosblade agent (such as the installation directory, log files, etc.).

| username: yytest | Original post link

Check the corresponding permissions.

| username: 小于同学 | Original post link

Squatting

| username: Jack-li | Original post link

Permission issue

| username: yytest | Original post link

See if it’s caused by permissions.

| username: TiDBer_YNzCG6n8 | Original post link

The Chaos Mesh daemon pod is started as the root user, so why is there a permission issue? Someone online explained that Chaos Mesh needs to run with the same user as the business Java process to resolve this permission issue.

The current problem is that the business Java process is started by a special user, while Chaos Mesh can only be started as the root user. So how should this permission issue be resolved? Thank you!

| username: CwenYin | Original post link

From the error message, it seems similar to this issue: JVMChaos: target process doesn't respond within 10500ms or hotspot vm not loaded · Issue #2588 · chaos-mesh/chaos-mesh · GitHub. What is the current kernel version of your k8s node? The documentation at Simulate JVM Application Faults | Chaos Mesh mentions that the kernel needs to be at least version 4.1.

| username: yytest | Original post link

When using Chaos Mesh, encountering the com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file error is usually because the Java Virtual Machine (JVM) attach API cannot access the target Java process’s socket file. This socket file is typically located at /tmp/.java_pid<pid>, where <pid> is the ID of the Java process.