最近遇到一个很奇怪的问题,Flink任务正常启动正常运行一段时间后就会报错,,错误详情如下

2019-12-11 17:20:57.757 flink [flink-scheduler-1] ERROR o.apache.flink.runtime.rest.handler.job.JobsOverviewHandler - Unhandled exception.akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://flink/user/dispatcher#761962841]] after [10000 ms]. Sender[null] sent message of type "org.apache.flink.runtime.rpc.messages.LocalFencedMessage".
at akka.pattern.PromiseActorRef$$anonfun$1.apply$mcV$sp(AskSupport.scala:604)
at akka.actor.Scheduler$$anon$4.run(Scheduler.scala:126)
at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:601)
at scala.concurrent.BatchingExecutor$class.execute(BatchingExecutor.scala:109)
at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:599)
at akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(LightArrayRevolverScheduler.scala:329)
at akka.actor.LightArrayRevolverScheduler$$anon$4.executeBucket$1(LightArrayRevolverScheduler.scala:280)
at akka.actor.LightArrayRevolverScheduler$$anon$4.nextTick(LightArrayRevolverScheduler.scala:284)
at akka.actor.LightArrayRevolverScheduler$$anon$4.run(LightArrayRevolverScheduler.scala:236)
at java.lang.Thread.run(Thread.java:745)

初步判断应该是触发了akka的超时机制,那就先调整集群的akka超时间配置,在conf/flink-conf.yaml最后增加下面参数

akka.ask.timeout: 100 s

观察Job Manager Configuration,配置参数已经生效

再将任务起起来,在运行十几个小时之后还是出现同样的错误,这就很奇怪了,明明更改了参数也生效了,为啥还是10000 ms就超时了

似乎有点邪门,只能Google一把了,在Apache Flink 中文用户邮件列表找到类似的问题,给出的建议是调整akka.ask.timeout和web.timeout两个参数

异常原因如上所说是 akka ask timeout 的问题,这个问题前两天有人在部署 k8s 的时候也遇过[1]

他的情况是配置资源过少导致 JM 未能及时响应。除了调整上述参数外也可看看是不是这个问题。

Best,
tison. [1]
https://lists.apache.org/thread.html/84db9dca2e990dd0ebc30aa35390ac75a0e9c7cbfcdbc2029986d4d7@%3Cuser-zh.flink.apache.org%3E Biao Liu <[hidden email]> 于2019年8月8日周四 下午8:00写道: > 你好,
>
> 异常里可以看出 AskTimeoutException, 可以调整两个参数 akka.ask.timeout 和 web.timeout
> 再试一下,默认值如下
>
> akka.ask.timeout: 10 s
> web.timeout: 10000
>
> PS: 搜 “AskTimeoutException Flink” 可以搜到很多相关答案
>
> Thanks,
> Biao /'bɪ.aʊ/

这我就有点奇怪了,错误和web.timeout有啥关系啊,只能顺着错误翻看Flink源码了。在源码重直接找到JobsOverviewHandler类,发现引用这个类就两个:一个是JobsOverviewHeaders,主要是作为一个link;另外一个是WebMonitorEndpoint,

在这实例化了一个JobsOverviewHandler,传入了timeout参数

protected final RestHandlerConfiguration restConfiguration;

final Time timeout = restConfiguration.getTimeout();

JobsOverviewHandler jobsOverviewHandler = new JobsOverviewHandler(leaderRetriever,timeout,responseHeaders,JobsOverviewHeaders.getInstance());

再追踪timeout来源发现取自RestHandlerConfiguration Timeout字段,而这个值来自WebOptions.TIMEOUT

    public static RestHandlerConfiguration fromConfiguration(Configuration configuration) {
final long refreshInterval = configuration.getLong(WebOptions.REFRESH_INTERVAL); final int maxCheckpointStatisticCacheEntries = configuration.getInteger(WebOptions.CHECKPOINTS_HISTORY_SIZE); final Time timeout = Time.milliseconds(configuration.getLong(WebOptions.TIMEOUT)); final String rootDir = "flink-web-ui";
final File webUiDir = new File(configuration.getString(WebOptions.TMP_DIR), rootDir); return new RestHandlerConfiguration(
refreshInterval,
maxCheckpointStatisticCacheEntries,
timeout,
webUiDir);
}

    /**
* Timeout for asynchronous operations by the web monitor in milliseconds.
*/
public static final ConfigOption<Long> TIMEOUT =
key("web.timeout")
.defaultValue(10L * 1000L)
.withDescription("Timeout for asynchronous operations by the web monitor in milliseconds.");

这下真相大白,果然需要调整web.timeout参数,是web监视器的异步操作超时时间,默认10000ms。将该值提高到300000ms,继续观察。

参考

https://zhuanlan.zhihu.com/p/49095640

http://apache-flink.147419.n8.nabble.com/Fwd-need-help-td321.html#a349

最新文章

  1. HDOJ 1009. Fat Mouse&#39; Trade 贪心 结构体排序
  2. 纯JS实现俄罗斯方块,打造属于你的游戏帝国
  3. PRINCE2第二个原则
  4. Microsoft Office Project 相关教程 收集
  5. JS+JavaBean判断管理员增删改的操作权限
  6. 高效率http页面优化法则一【JS对DOM的操作】
  7. TCP/IP协议原理与应用笔记04:子网掩码
  8. c++实现委托
  9. [Android]Gradle 插件 DiscardFilePlugin(class注入&amp;清空类和方法)
  10. UILabel-UITextField-UIBotton&amp;nbsp;UI_…
  11. docker-compose安装
  12. [转帖]Docker容器CPU、memory资源限制
  13. win10 下JDK10的下载安装与环境变量配置
  14. SpringBoot2静态资料访问
  15. 1. ibatis 查询的sql列存在相同的列名
  16. json ubuntu下安装
  17. OpenCV——图像的载入、显示、输出到文件和滑动条、鼠标操作
  18. k近邻法(KNN)和KMeans算法
  19. 在 Docker 上运行一个 RESTful 风格的微服务
  20. JAVA的静态代理与动态代理比较--转载

热门文章

  1. Flink Table API &amp; SQL 自定义Redis Sink 使用方式
  2. ScrollView里面不能嵌套一个FlatList,这个需要如何通过FlatList自己单独实现
  3. 1.Python3.5+Pyqt5+PyCharm+Opencv3.3+Qtdesigner开发环境配置
  4. Spark 中三种数据处理对象的区别: RDD-Dataset-Dataframe
  5. NGINX websocket 配制
  6. 安卓app的签名打包
  7. pytest 之conftest.py是什么
  8. 【服务器数据恢复】RAID6数据恢复案例
  9. 调度平台&amp;定时任务
  10. Linux程序设计