Flink on yarn模式下,JobManager异常退出问题

这个问题排除了很久,其中更换了Flink版本,也更换了Hadoop版本一直无法解决,JobManager跑着跑着就异常退出了。资源管理器上是提示运行结束,运行状态是被Kill掉。

网上搜了一圈,都说内存不足、资源不足,配置错误。但是报错非常不明显。

最后终于看到了一条警告日志。

是客户端与jobmanager心跳超时,协商退出的jobmanager。后面就开始取消任务,回收资源逐步退出。除了这条关键退出日志,就没有明显的报错了。

复制代码
2024-10-24 17:41:15,073 WARN  org.apache.flink.runtime.dispatcher.MiniDispatcher           [] - The heartbeat from the job client is timeout and cancel the job cc0f9dcadc79ee561632518539baf513. You can adjust the heartbeat interval by 'client.heartbeat.interval' and the timeout by 'client.heartbeat.timeout'

其实提交Flink on Yarn的Pro-Job程序,从开始到结束都有心跳异常的错误。最后超过默认的超时时间180s就开始协商退出了,所以程序每次跑3分钟后就开始退出了。

复制代码
2024-10-24 17:40:15,725 ERROR org.apache.flink.runtime.rest.handler.job.JobClientHeartbeatHandler [] - Exception occurred in REST handler: Request did not match expected format JobClientHeartbeatRequestBody.

只在yarn-per-job与yarn-application模式下会触发,session模式下不会。因为session模式是一直存在jobmanager,他会接受任何客户端的任务。不需要用完就释放资源。

Flink 1.13.1、Flink1.15.2、Flink1.16.3都不存在以上问题

但是1.17.1和1.18.1、1.20都存在该问题。应该是1.17以上都存在

某大神说的1.17引入新的心跳机制:

复制代码
The issue you're encountering is related to a new heartbeat mechanism
between the client and job in Flink-1.17. If the job does not receive any
heartbeats from the client within a specific timeout, it will cancel itself
to avoid hanging indefinitely.
复制代码
To address this, you have two options:
1. Run your job in detached mode by adding the -d option in your command
line
2. Increase the client heartbeat timeout setting to a larger value, the
default value is 180 seconds

解决办法总结了下,大概三种

1、用旧点的Flink版本:例如Flink1.16.3以下;

2、分离模式,加 -d参数;

3、增加心跳超时时间;这个其实无法根本解决;

新版本还是多坑,其实很有一个可能flink1.17开始去除java代码,导致的bug问题

相关推荐
晚霞的不甘1 天前
Flutter/OpenHarmony 三方库适配实战:google_maps_flutter 地图
flutter·macos·华为·cocoa·harmonyos·1024程序员节
开开心心就好8 天前
显示器关不掉怎么办,用小工具一键息屏
算法·智能手机·pdf·计算机外设·ocr·lua·1024程序员节
Evand J8 天前
【MATLAB例程】基于IMM-EKF与AOA/测距融合的二维移动目标跟踪定位
matlab·代码·定位·1024程序员节·toa·aoa
普通人612 天前
PHP多维数组排序完全指南
开发语言·php·1024程序员节
普通人614 天前
WebGL与WebGPU入门指南
开发语言·webgl·1024程序员节
猫猫不是喵喵.14 天前
从0到1创建一个微服务项目
java·数据库·微服务·1024程序员节
fish_zzzz18 天前
笔记-论数据结构2
1024程序员节
普通人618 天前
PHP文件读写完全指南
开发语言·php·1024程序员节
Martina_032118 天前
AI生成3D场景从白模换成精模后镜头全偏了?用6步检查单位、枢轴与层级替换
图像处理·人工智能·3d·ai·自然语言处理·材质·1024程序员节
星云_byto20 天前
CSS布局
人工智能·机器学习·目标跟踪·1024程序员节