sofa-ark icon indicating copy to clipboard operation
sofa-ark copied to clipboard

AgentClassLoader导致Container类加载范围增大

Open yuanyuancin opened this issue 1 year ago • 3 comments

ContainerClassLoader 类加载行为

  1. 如果是 ark export 的类,委托应用类加载器加载(本地启动为AppClassLoader、SpringBoot启动LaunchedURLClassLoader)
  2. 如果点1没找到,ContainerClassLoader 自身加载 sofa-ark-all 中的类

在修复 Fix skywalking agent issues

ContainerClassLoader 类加载行为,改变为:

  1. 如果是 ark export 的类,委托应用类加载器加载(本地启动为AppClassLoader、SpringBoot启动LaunchedURLClassLoader)
  2. 如果点1没找到,ContainerClassLoader 自身加载 sofa-ark-all 中的类
  3. 如果点2没找到,委托AgentClassLoader加载(AgentClassLoader的parent为应用类加载器)

点3导致类加载的范围扩大到最终兜底走应用类加载器

yuanyuancin avatar Dec 12 '23 13:12 yuanyuancin

com.alipay.sofa.ark.bootstrap.AbstractLauncher#createContainerClassLoade 中 设置AgentClassLoader.parent = SystemClassLoader 可以避免在 spring boot fat jar 启动时扩大范围,但不可解决 本地启动

yuanyuancin avatar Dec 13 '23 08:12 yuanyuancin

This issue has been automatically marked as stale because it has not had recent activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue or help wanted) or other activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 13 '24 02:01 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue or help wanted) or other activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 13 '24 02:02 github-actions[bot]