sofastack / sofa-ark

SOFAArk is a light-weight,java based classloader isolation framework.
https://www.sofastack.tech/projects/sofa-boot/sofa-ark-readme/
Apache License 2.0
1.54k stars 488 forks source link

AgentClassLoader导致Container类加载范围增大 #808

Open yuanyuancin opened 7 months ago

yuanyuancin commented 7 months ago

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 commented 7 months ago

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

github-actions[bot] commented 6 months ago

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] commented 5 months ago

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.