最近遇到一个很奇怪的问题,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

Flink akka AskTimeoutException问题排查的更多相关文章

  1. 记录一次Flink作业异常的排查过程

    最近2周开始接手apache flink全链路监控数据的作业,包括指标统计,业务规则匹配等逻辑,计算结果实时写入elasticsearch. 昨天遇到生产环境有作业无法正常重启的问题,我负责对这个问题 ...

  2. Flink on YARN(下):常见问题与排查思路

    Flink 支持 Standalone 独立部署和 YARN.Kubernetes.Mesos 等集群部署模式,其中 YARN 集群部署模式在国内的应用越来越广泛.Flink 社区将推出 Flink ...

  3. Flink run提交参数

    折腾了好几天,终于搞定了Flink run提交参数,记录一下. 背景: 之前一直报错,akka,AskTimeoutException,尝试添加akka.ask.timeout=120000s, 依然 ...

  4. Flink源码分析

    http://vinoyang.com/ http://wuchong.me Apache Flink源码解析之stream-source https://yq.aliyun.com/articles ...

  5. Flink articles

    http://ictlabs-summer-school.sics.se/2015/slides/flink-advanced.pdf http://henning.kropponline.de/20 ...

  6. flink clickhouse-jdbc和flink-connector 写入数据到clickhouse因为jar包冲突导致的60 seconds.Please check if the requested resources are available in the YARN cluster和Could not resolve ResourceManager address akka报错血案

    一.问题现象,使用flink on yarn 模式,写入数据到clickhouse,但是在yarn 集群充足的情况下一直报:Deployment took more than 60 seconds. ...

  7. 报错:Flink Could not resolve substitution to a value: ${akka.stream.materializer}

    报错现象: Exception in thread "main" com.typesafe.config.ConfigException$UnresolvedSubstitutio ...

  8. Flink Checkpoint 问题排查实用指南

    在 Flink 中,状态可靠性保证由 Checkpoint 支持,当作业出现 failover 的情况下,Flink 会从最近成功的 Checkpoint 恢复.在实际情况中,我们可能会遇到 Chec ...

  9. flink RPC(akka)

    flink中的rpc框架使用的akka.在本节并不详细讲述akka,而是就flink中rpc来讲述akka的部分内容.本节,我从AkkaRpcActor.handleRpcInvocation方法讲起 ...

  10. 深入理解Akka Actor模型

    Carl Hewitt 在1973年对Actor模型进行了如下定义:"Actor模型是一个把'Actor'作为并发计算的通用原语". Actor是异步驱动,可以并行和分布式部署及运 ...

随机推荐

  1. C# 读取电脑CPU、主板、硬盘序列号等信息

    ManagementObjectSearcher 解析不到头文件,需要手动 Add Referance 需要添加引用:System.Management,然后引入命名空间:using System.M ...

  2. Mac下配置Groovy

    官网:http://www.groovy-lang.org/ Step 1:下载Groovy 地址:https://groovy.apache.org/download.html 下载后解压 Step ...

  3. 第二性 合卷本 横本.EPUB

    书本详情 第二性台版 作者: 西蒙.德.波娃(Simone de Beauvoir)出版社: 貓頭鷹原作名: Le Deuxième Sexe译者: 邱瑞鑾出版年: 2013-10页数: 1136装帧 ...

  4. 最新go语言学习教程

    go语言学习教程 集合了连接go routine.go连接redis.go连接kafka等示例,所有代码均经过实践,可以直接使用 https://github.com/fastbpmn/go-stud ...

  5. P1219 [USACO1.5]八皇后 Checker Challenge

    好长时间没登博客园了,今天想起了账号密码,遂发一篇题解 最近因为复赛正在复健搜索,所以做了这道题 这道题说难并不是很难,但是在于这个题需要找到两个规律 以下是原题 [USACO1.5]八皇后 Chec ...

  6. k8s 基础

    创建pod(kubectl create -f {podname} .yaml pod  "{podname} " created -n {namespace}) cat name ...

  7. mysql表关联更新

    UPDATE enterprise_test t1, enterprise_development_relation t2 SET t1.development_area_id = t2.develo ...

  8. Jenkins自动化部署(linux环境)---安装篇

    1.安装java yum install java 2.安装Jenkins wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.or ...

  9. CPU、内存的占用率

    要获取不包含百分比符号的内存占用率: #free -t | awk 'NR ==2 {print "Current Memory Utilization is: "$3/$2*10 ...

  10. 通过xshell在linux上安装nginx1.12.0

    0)环境安装 Nginx是C语言开发,建议在 Linux 上运行,当然,也可以安装 Windows 版本,本篇则使用 CentOS 7 作为安装环境. 0.1 gcc 安装 安装 nginx 需要先将 ...