com.alibaba.fastjson2.util.DynamicClassLoader 类加载过多,造成jvm元空间内存使用达到99%
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 问题描述
我在线上服务排查发现,class loader数量巨多,导致监控内存飙升,元空间内存使用率达到 99.1% 通过arthas发现fastjson2中类加载数量很大,但是我自己项目中都是正常使用的fastjson,没有哪里可能有那么大的类加载。而且类加载数量一致持续升高,垃圾回收不掉,不知道是不是fastjson包里面哪里类加载过大还是什么问题


### 环境信息
*请填写以下信息:*
- JDK信息: [Openjdk 1.8.0_391]
- 版本信息:[Fastjson2 2.0.42]
### 重现步骤
*如何操作可以重现该问题:*
1. 使用 `xxx.xxx` 方法
2. 输入 `...` 数据
3. 出现 `...` 错误
```java
//可在此输入示例代码
```
### 期待的正确结果
*对您期望发生的结果进行清晰简洁的描述。*
### 相关日志输出
*请复制并粘贴任何相关的日志输出。*
#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*
Contributor guide
Research direction
Start with DynamicClassLoader and reproduce the reported class-loader growth using the stated OpenJDK 1.8.0_391 and Fastjson2 2.0.42 environment. Use Arthas to inspect loader counts and metaspace behavior; done means identifying a Fastjson2-related cause or obtaining a minimal reproducible case with enough logs to diagnose it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100