@Override
public void close() throws Exception {
 RuntimeContext runtimeContext = getRuntimeContext();
 runtimeContext.registerUserCodeClassLoaderReleaseHookIfAbsent("dad", () -> {
if (null != connection) {
try {
connection.close();
 } catch (SQLException e) {
throw new RuntimeException(e);
 }
 }
 Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
 Driver driver = drivers.nextElement();
try {
 DriverManager.deregisterDriver(driver);
 } catch (SQLException e) {
throw new RuntimeException(e);
 }
 }
 AbandonedConnectionCleanupThread.uncheckedShutdown();
 });
}

------------------------------------------------------------------
发件人:Xuyang<xyzhong...@163.com>
日 期:2024年01月12日 16:36:01
收件人:<user-zh@flink.apache.org>
主 题:Re:Flink1.16版本java.lang.OutOfMemoryError: Metaspace

Hi, 你的图挂了,贴一下代码吧。



--

    Best!
    Xuyang




在 2024-01-12 16:23:13,"Summer_Gu" <gubin...@bravowhale.com> 写道:

版本号:1.16
部署方式: Standalone Cluster集群部署
问题:通过webUi提交任务后,立马使任务报错,重复提交,会导致Metaspace内存溢出,(红框部分)




我看见官网有这部分说明:https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/ops/debugging/debugging_classloading/#unloading-of-dynamically-loaded-classes-in-user-code
但是我在代码中填入:
并不起作用,所以想问一下是否使用方式有问题?或者还有其他解决方案吗?


回复