alibaba / alibaba/fastjson2

[BUG] 出现MDO extra data lock 异常

Open
#2,980 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

### 问题描述
在生产环境切换fastjson2之后我发现项目的堆外内存出现平滑曲线上升

### 环境信息
*请填写以下信息:*

- OS信息: [e.g.:CentOS 4Core 3.10GHz 8 GB]
- JDK信息: [e.g.:
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)]
- 版本信息:[e.g.:Fastjson2 2.0.49]

### 重现步骤
因项目中存在部分日志打印使用JSON.toJsonString

### 相关日志输出
通过 pmap 查看虚拟内存信息 对比两个小时前后的内存变化发现,多出部分没有被回收的内存
![image](https://github.com/user-attachments/assets/6c79abb3-fa94-486a-b3e6-0d73007bd06b)
使用gdb 工具对相关内存地址进行检查发现大部分都是这部分异常
![image](https://github.com/user-attachments/assets/55d58011-19f7-415f-984e-5f5839d47d74)
看起来是每次都会加载Fastjson创建的代理类 在fastjson1版本好像也存在这个问题

Contributor guide

Open the contributing guide

Research direction

Start with the JSON.toJsonString call described in the reproduction steps and compare fastjson2 with fastjson1 under the reported production workload. Use pmap and gdb to inspect whether proxy-class-related memory grows over time; a useful result would reproduce the growth and identify whether fastjson2 retains those allocations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.