apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.48k stars 26.43k forks source link

Dubbo 2.7.8 OOM #6847

Closed luckyyuandm closed 3 years ago

luckyyuandm commented 4 years ago

Environment

Steps to reproduce this issue

  1. dubbo线程数设置500或者更多
  2. 每次请求的数据量尽量大,我们的环境是10M左右

运行一段时间后就会内存溢出,我们的环境上10分钟左右就会溢出。 监控内存占用情况如下:

WechatIMG391

排查发现,是org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectInput这个类里面有线程局部变量,会持有序列化过程中的数据,不会释放。导致内存溢出。

下面是修改方法,已在测试环境验证

WechatIMG393

WechatIMG394
chowsGh commented 3 years ago
  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.
  • [ ] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.8
  • Operating System version: linux
  • Java version: 1.8

Steps to reproduce this issue

  1. dubbo线程数设置500或者更多
  2. 每次请求的数据量尽量大,我们的环境是10M左右

运行一段时间后就会内存溢出,我们的环境上10分钟左右就会溢出。 监控内存占用情况如下:

WechatIMG391

排查发现,是org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectInput这个类里面有线程局部变量,会持有序列化过程中的数据,不会释放。导致内存溢出。

下面是修改方法,已在测试环境验证

WechatIMG393

WechatIMG394

你好,请问你有遇到在dubbo payload设置为很大的时候例如100MB, Hessian2Input 中_sbuf 这个StringBuilder,内部的char[] 数组占用大量内存未释放吗

lovepoem commented 3 years ago

@luckyyuandm Would you please send a pr ?

CrazyHZM commented 3 years ago

The new version has been optimized. Try it with the latest version, if you still have problems, you can reopen the issue.