Open cfangpp opened 5 days ago
目标进程进入了死循环,流程如下:
java.lang.StackOverflowError: null at java.security.ProtectionDomain.implies(ProtectionDomain.java:279) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:450) at java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:1528) at java.lang.Class.getClassLoader(Class.java:683) at com.taobao.arthas.core.advisor.SpyImpl.atEnter(SpyImpl.java:28) at java.arthas.SpyAPI.atEnter(SpyAPI.java:59) at org.elasticsearch.bootstrap.ESPolicy.implies(ESPolicy.java) at java.security.ProtectionDomain.implies(ProtectionDomain.java:279) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:450) at java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:1528) at java.lang.Class.getClassLoader(Class.java:683) at com.taobao.arthas.core.advisor.SpyImpl.atEnter(SpyImpl.java:28) at java.arthas.SpyAPI.atEnter(SpyAPI.java:59) at org.elasticsearch.bootstrap.ESPolicy.implies(ESPolicy.java)
解决办法,定制SecureSM的checkPermission方法,跳过检查
@Override
public void checkPermission(Permission perm) {
// just for arthas
if (perm instanceof RuntimePermission && "getClassLoader".equals(perm.getName())) {
for (StackTraceElement element : Thread.currentThread().getStackTrace()) {
if ("java.arthas.SpyAPI".equals(element.getClassName())) {
return;
}
}
}
super.checkPermission(perm);
}
环境信息
arthas-boot.jar
或者as.sh
的版本: xxxarthas-boot
的版本: xxx重现问题的步骤
期望的结果
为什么?
实际运行的结果
实际运行结果,最好有详细的日志,异常栈。尽量贴文本。