alibaba / jvm-sandbox

Real - time non-invasive AOP framework container based on JVM
GNU Lesser General Public License v3.0
6.69k stars 1.55k forks source link

出现了加载插件失败,这个该如何处理 #427

Closed xiaotongduoyi closed 1 year ago

xiaotongduoyi commented 1 year ago

2023-05-23 17:41:39 default WARN loading module occur error when load-completed. module=test at com.test.plugin.core.impl.AbstractInvokePluginAdapter.watchIfNecessary(AbstractInvokePluginAdapter.java:159) at com.test.plugin.core.impl.AbstractInvokePluginAdapter.watch(AbstractInvokePluginAdapter.java:54) at com.test.module.TestModule.loadCompleted(TestModule.java:114) at com.alibaba.jvm.sandbox.core.manager.impl.ModuleJarLoader.loadingModules(ModuleJarLoader.java:88) at com.alibaba.jvm.sandbox.core.manager.impl.ModuleJarLoader.load(ModuleJarLoader.java:126) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.lang.reflect.Method.invoke(Method.java:498) at com.alibaba.jvm.sandbox.core.util.SandboxProtector$2.invoke(SandboxProtector.java:91) at com.sun.proxy.$Proxy0.reset(Unknown Source) at com.alibaba.jvm.sandbox.core.server.jetty.JettyCoreServer.bind(JettyCoreServer.java:197) at com.alibaba.jvm.sandbox.core.server.ProxyCoreServer.bind(ProxyCoreServer.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

xiaotongduoyi commented 1 year ago

java.lang.NoSuchMethodError:

oldmanpushcart commented 1 year ago

这个异常堆栈不完整,能否给出更详细的堆栈,描述AbstractInvokePluginAdapter.java:159发生的问题

xiaotongduoyi commented 1 year ago

我已经发现问题了,有个问题一直想问下,我们公司目前用的起sandbox链路,这个支持采样率吗,如何做

---原始邮件--- 发件人: @.> 发送时间: 2023年6月1日(周四) 下午5:18 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

这个异常堆栈不完整,能否给出更详细的堆栈,描述AbstractInvokePluginAdapter.java:159 发生的问题

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

oldmanpushcart commented 1 year ago

不支持采样率,被拦截的方法百分之百的调用都会引起事件回调。因为sandbox本身的性能开销不高,真正耗性能的大头是module。

另外如果性能很敏感,建议使用EventListener,不要用AdviceListener

xiaotongduoyi commented 1 year ago

说下使用场景,我们这边是用sandbox做链路日志产生的,有些业务链路太多,后台存储和消费可能都有压力,所以想配置采样率,比如只上传10%的链路日志上来

---原始邮件--- 发件人: @.> 发送时间: 2023年6月2日(周五) 中午11:25 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

不支持采样率,被拦截的方法百分之百的调用都会引起事件回调。因为sandbox本身的性能开销不高,真正耗性能的大头是module。

另外如果性能很敏感,建议使用EventListener,不要用AdviceListener

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

oldmanpushcart commented 1 year ago

这个采样率的控制你们可以写在你们自己的module中

xiaotongduoyi commented 1 year ago

有指导样例吗?这个该怎么写,这个module怎么保证请求进来了都先执行它

---原始邮件--- 发件人: @.> 发送时间: 2023年6月2日(周五) 中午11:33 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

这个采样率的控制你们可以写在你们自己的module中

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

oldmanpushcart commented 1 year ago

我对“请求进来了都执行它”这个要求不大理解,这个“它”是什么?

xiaotongduoyi commented 1 year ago

说下我的理解,采样,就是取请求的的比例,它就是指请求,如果是自己写module,那么请求进来的话,就要先执行这个module

---原始邮件--- 发件人: @.> 发送时间: 2023年6月2日(周五) 中午11:39 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

我对“请求进来了都执行它”这个要求不大理解,这个“它”是什么?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

oldmanpushcart commented 1 year ago

还是不理解,如果module观察了一个方法,那这个方法请求进来的时候一定会被执行到呀

xiaotongduoyi commented 1 year ago

可是这个方法,我是一个公共组件,无法定义

---原始邮件--- 发件人: @.> 发送时间: 2023年6月2日(周五) 中午11:45 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

还是不理解,如果module观察了一个方法,那这个方法请求进来的时候一定会被执行到呀

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

oldmanpushcart commented 1 year ago

我是着实不明白,能上代码最好

xiaotongduoyi commented 1 year ago

OK,等等哈,保持联系

---原始邮件--- 发件人: @.> 发送时间: 2023年6月2日(周五) 晚上10:22 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

我是着实不明白,能上代码最好

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

xiaotongduoyi commented 1 year ago

还有个问题问下,如果创建了一个filter和sandbox的module都对dubbo做了拦截,那个会生效,还是都会生效

---原始邮件--- 发件人: @.> 发送时间: 2023年6月2日(周五) 晚上10:22 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

我是着实不明白,能上代码最好

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

oldmanpushcart commented 1 year ago

@xiaotongduoyi 你想问的意思是两个module对同一个方法进行了拦截是么? 先拦截的能感知到后拦截的。如果对同一个方法先后进行了A、B两次拦截,数据会先到B拦截器进行处理,然后才到A

xiaotongduoyi commented 1 year ago

倒不是,我目前自己解决了采样率的问题,只是在想agent启动过程中能传参数到sandbox中吗?比如传采样率为0.01过去

---原始邮件--- 发件人: @.> 发送时间: 2023年6月12日(周一) 下午2:13 收件人: @.>; 抄送: @.**@.>; 主题: Re: [alibaba/jvm-sandbox] 出现了加载插件失败,这个该如何处理 (Issue #427)

@xiaotongduoyi 你想问的意思是两个module对同一个方法进行了拦截是么? 先拦截的能感知到后拦截的。如果对同一个方法先后进行了A、B两次拦截,数据会先到B拦截器进行处理,然后才到A

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

oldmanpushcart commented 1 year ago

@xiaotongduoyi 这个已经不是sandbox的问题了,agent启动过程中可以通过JVM参数传递,在java.lang.System#getProperties()中获取参数值