dragonwell-project / dragonwell8

Alibaba Dragonwell8 JDK
http://dragonwell-jdk.io
GNU General Public License v2.0
4.21k stars 497 forks source link

[Bug] 内存泄漏问题 #546

Open sizuoyi00 opened 1 year ago

sizuoyi00 commented 1 year ago

Description 使用多租户中的内存资源隔离限制,代码如下,近期发现有内存溢出现象,4g内存,jvm堆内存1254m,泄漏内存300m+ 经过定位发现com.alibaba.tenant.TenantContainer#destroy方法,没有释放ResourceContainerMonitor中的resourceContainerMap

dragonwell 8.13.14

启动参数 -XX:+MultiTenant -XX:+TenantHeapThrottling -XX:+TenantHeapIsolation -Xms1254m -Xmx1254m -XX:-ExitOnOutOfMemoryError

image

代码会多次创建容器并销毁 public Runnable submit2TenantContainer(FutureTask futureTask) { return () -> { TenantContainer limiter = TenantContainer.create(new TenantConfiguration().limitHeap(256 1024 1024)); try { limiter.run(futureTask); } catch (TenantException e) { futureTask.cancel(true); } finally { limiter.destroy(); } }; }