Hadoop3 ShutdownHookManager visit closed ClassLoader

在yarn集群上启动一个flink任务,抛出如下异常:

Exception in thread "Thread-5" java.lang.IllegalStateException: Trying to access closed classloader. Please check if you store classloaders directly or indirectly in static fields. If the stacktrace suggests that the leak occurs in a third party library and cannot be fixed immediately, you can disable this check with the configuration 'classloader.check-leaked-classloader'.
        at org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders$SafetyNetWrapperClassLoader.ensureInner(FlinkUserCodeClassLoaders.java:164)
        at org.apache.flink.runtime.execution.librarycache.FlinkUserCodeClassLoaders$SafetyNetWrapperClassLoader.getResource(FlinkUserCodeClassLoaders.java:183)
        at org.apache.hadoop.conf.Configuration.getResource(Configuration.java:2737)
        at org.apache.hadoop.conf.Configuration.getStreamReader(Configuration.java:2993)
        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2952)
        at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2925)
        at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2805)
        at org.apache.hadoop.conf.Configuration.get(Configuration.java:1199)
        at org.apache.hadoop.conf.Configuration.getTimeDuration(Configuration.java:1787)
        at org.apache.hadoop.util.ShutdownHookManager.getShutdownTimeout(ShutdownHookManager.java:183)
        at org.apache.hadoop.util.ShutdownHookManager.shutdownExecutor(ShutdownHookManager.java:145)
        at org.apache.hadoop.util.ShutdownHookManager.access$300(ShutdownHookManager.java:65)
        at org.apache.hadoop.util.ShutdownHookManager$1.run(ShutdownHookManager.java:102)

任务虽然可以正常运行,但是为了安全,还是google了一下这个错误,发现官方issue:

https://issues.apache.org/jira/browse/FLINK-19916
 

This is because Hadoop 3 starts asynchronous threads to execute some shutdown hooks.
These hooks are run after the job is executed, as a result, the classloader has been released, but in hooks, configuration still holds the released classloader, so it will fail to throw an exception in this asynchronous thread.

Now it doesn't affect our function, it just prints the exception stack on the console.

大致意思是:由于hadoop3引入了异步的线程来执行shutdown hook,该hook会在任务执行时运行,由于classloader已经被释放,但是hook中仍然持有该classloader而跑出异常。该异常不影响正常功能,仅在控制台打印日志。

网上提出一种解决方法:在 flink 配置文件里 flink-conf.yaml设置 classloader.check-leaked-classloader: false

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赶路人儿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值