开发者社区> 问答> 正文

flink遇到 valueState 自身的 NPE怎么办?

早上发现任务异常,task 在不停重启,遂查看 jm 日志,最开始的报错是这样的

2020-01-09 05:14:04.087 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (3/6) (d0e6c4a05d0274c18a4a3df41ab5ff1b) switched from
RUNNING to FAILED.
java.lang.NullPointerException: null
at com.sogou.qidian.MyMapFunction2.map(MyMapFunction2.java:39)
at com.sogou.qidian.MyMapFunction2.map(MyMapFunction2.java:25)
at
org.apache.flink.streaming.api.operators.StreamMap.processElement(StreamMap.java:41)
at
org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processElement(StreamOneInputProcessor.java:164)
at
org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:143)
at
org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:279)
at
org.apache.flink.streaming.runtime.tasks.StreamTask.run(StreamTask.java:301)
at
org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:406)
at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:705)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:530)
at java.lang.Thread.run(Thread.java:748)
2020-01-09 05:14:04.088 [flink-akka.actor.default-dispatcher-28] INFO
o.a.f.r.e.failover.flip1.RestartPipelinedRegionStrategy - Calculating
tasks to restart to recover the failed task
90bea66de1c231edf33913ecd54406c1_2.
2020-01-09 05:14:04.088 [flink-akka.actor.default-dispatcher-28] INFO
o.a.f.r.e.failover.flip1.RestartPipelinedRegionStrategy - 12 tasks should
be restarted to recover the failed task 90bea66de1c231edf33913ecd54406c1_2.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (6/6) (ac52050e60236cd1efcd262c8240cd25) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (5/6) (cf4ff0c189315b27e7e2178d8c60e49f) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (4/6) (8c8b07cb39a3f682f41f102e614765e6) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (3/6) (34aadddbffe9f61b1916bcd1427ced96) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (6/6) (de624cf5c9d4dec6fe68d4800c701457) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (4/6) (e52c1e70884a6599205f9e0f5b092bc0) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (5/6) (60496dddb4bc885ee37a6025662080ad) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.089 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (2/6) (bf8515b4f9e852182a5519102fe4fdf3) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.090 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (2/6) (bb14d5776c53babcc57edd65bf7159b0) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.090 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (1/6) (4c7cd6eaf5c3ca9c2b0db73e7d230a9e) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.090 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (1/6) (4a157d98db2f2efad72035af279433ff) switched from
RUNNING to CANCELING.
2020-01-09 05:14:04.096 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (1/6) (4c7cd6eaf5c3ca9c2b0db73e7d230a9e) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.101 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (2/6) (bb14d5776c53babcc57edd65bf7159b0) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.103 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (5/6) (cf4ff0c189315b27e7e2178d8c60e49f) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.115 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (2/6) (bf8515b4f9e852182a5519102fe4fdf3) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.119 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (4/6) (e52c1e70884a6599205f9e0f5b092bc0) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.140 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (6/6) (de624cf5c9d4dec6fe68d4800c701457) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.140 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Discarding the
results produced by task execution de624cf5c9d4dec6fe68d4800c701457.
2020-01-09 05:14:04.141 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (6/6) (ac52050e60236cd1efcd262c8240cd25) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.141 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (5/6) (60496dddb4bc885ee37a6025662080ad) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.141 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Discarding the
results produced by task execution 60496dddb4bc885ee37a6025662080ad.
2020-01-09 05:14:04.142 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (4/6) (8c8b07cb39a3f682f41f102e614765e6) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.142 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (1/6) (4a157d98db2f2efad72035af279433ff) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.142 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Discarding the
results produced by task execution 4a157d98db2f2efad72035af279433ff.
2020-01-09 05:14:04.143 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (3/6) (34aadddbffe9f61b1916bcd1427ced96) switched from
CANCELING to CANCELED.
2020-01-09 05:14:04.143 [flink-akka.actor.default-dispatcher-28] INFO
o.a.f.r.e.failover.AdaptedRestartPipelinedRegionStrategyNG - Finally
restart 12 tasks to recover from task failure.
2020-01-09 05:14:04.144 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.checkpoint.CheckpointCoordinator - Restoring job
7907d93e17fccf460069c2ca7f13d7e7 from latest valid checkpoint: Checkpoint
720 @ 1578518011978 for 7907d93e17fccf460069c2ca7f13d7e7.
2020-01-09 05:14:04.145 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.checkpoint.CheckpointCoordinator - No master
state to restore
2020-01-09 05:14:04.145 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (2/6) (d83eee0b90a0e4a4dcff3e1ca6bed8b6) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.145 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (4/6) (da6e91a7475712da5ca52fc82069345f) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.145 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (1/6) (ffa3b56b4e1321aa5ec94e040921e223) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.145 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (3/6) (5c3fb959f79d53cdca506188ed40cc6d) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (5/6) (7a2252b0a18cd91211adae3ce3b613be) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (6/6) (6010486f42fc1e0e7c93623174bf0477) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (1/6) (eb06b4212d17f10cf4a8bcc812eaa073) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (2/6) (af4e3fc75729a2d035db42ec95e44189) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (3/6) (adb9b0aabe0234fe336211f5e44e18f3) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (4/6) (9ad2c9ee62ff804683284b0cdf571c99) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.146 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (6/6) (1e66dc5791940cf7e213b1b3cf8cf1fd) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (5/6) (4cb656b991141acbbe9e1033103ab470) switched from
CREATED to SCHEDULED.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (2/6) (d83eee0b90a0e4a4dcff3e1ca6bed8b6) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying
Source: Custom Source -> Filter (2/6) (attempt #2) to
container_e06_1577354972821_672000_01_000003 @
rsync.slave713.mars.hadoop.js.ted (dataPort=15754)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (4/6) (da6e91a7475712da5ca52fc82069345f) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying
Source: Custom Source -> Filter (4/6) (attempt #2) to
container_e06_1577354972821_672000_01_000002 @
rsync.slave713.mars.hadoop.js.ted (dataPort=20658)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (1/6) (ffa3b56b4e1321aa5ec94e040921e223) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying
Source: Custom Source -> Filter (1/6) (attempt #2) to
container_e06_1577354972821_672000_01_000003 @
rsync.slave713.mars.hadoop.js.ted (dataPort=15754)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (3/6) (5c3fb959f79d53cdca506188ed40cc6d) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying
Source: Custom Source -> Filter (3/6) (attempt #2) to
container_e06_1577354972821_672000_01_000002 @
rsync.slave713.mars.hadoop.js.ted (dataPort=20658)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (5/6) (7a2252b0a18cd91211adae3ce3b613be) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying
Source: Custom Source -> Filter (5/6) (attempt #2) to
container_e06_1577354972821_672000_01_000003 @
rsync.slave713.mars.hadoop.js.ted (dataPort=15754)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (6/6) (6010486f42fc1e0e7c93623174bf0477) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying
Source: Custom Source -> Filter (6/6) (attempt #2) to
container_e06_1577354972821_672000_01_000002 @
rsync.slave713.mars.hadoop.js.ted (dataPort=20658)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (1/6) (eb06b4212d17f10cf4a8bcc812eaa073) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying Map ->
Filter -> Sink: Unnamed (1/6) (attempt #2) to
container_e06_1577354972821_672000_01_000002 @
rsync.slave713.mars.hadoop.js.ted (dataPort=20658)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (2/6) (af4e3fc75729a2d035db42ec95e44189) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying Map ->
Filter -> Sink: Unnamed (2/6) (attempt #2) to
container_e06_1577354972821_672000_01_000003 @
rsync.slave713.mars.hadoop.js.ted (dataPort=15754)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (3/6) (adb9b0aabe0234fe336211f5e44e18f3) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying Map ->
Filter -> Sink: Unnamed (3/6) (attempt #2) to
container_e06_1577354972821_672000_01_000003 @
rsync.slave713.mars.hadoop.js.ted (dataPort=15754)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (4/6) (9ad2c9ee62ff804683284b0cdf571c99) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying Map ->
Filter -> Sink: Unnamed (4/6) (attempt #2) to
container_e06_1577354972821_672000_01_000003 @
rsync.slave713.mars.hadoop.js.ted (dataPort=15754)
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (6/6) (1e66dc5791940cf7e213b1b3cf8cf1fd) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.147 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying Map ->
Filter -> Sink: Unnamed (6/6) (attempt #2) to
container_e06_1577354972821_672000_01_000002 @
rsync.slave713.mars.hadoop.js.ted (dataPort=20658)
2020-01-09 05:14:04.148 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (5/6) (4cb656b991141acbbe9e1033103ab470) switched from
SCHEDULED to DEPLOYING.
2020-01-09 05:14:04.148 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Deploying Map ->
Filter -> Sink: Unnamed (5/6) (attempt #2) to
container_e06_1577354972821_672000_01_000002 @
rsync.slave713.mars.hadoop.js.ted (dataPort=20658)
2020-01-09 05:14:04.159 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (1/6) (ffa3b56b4e1321aa5ec94e040921e223) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.160 [flink-akka.actor.default-dispatcher-28] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (2/6) (d83eee0b90a0e4a4dcff3e1ca6bed8b6) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.161 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (5/6) (7a2252b0a18cd91211adae3ce3b613be) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.168 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (4/6) (9ad2c9ee62ff804683284b0cdf571c99) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.169 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (4/6) (da6e91a7475712da5ca52fc82069345f) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.170 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (6/6) (6010486f42fc1e0e7c93623174bf0477) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.170 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (2/6) (af4e3fc75729a2d035db42ec95e44189) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.173 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (3/6) (adb9b0aabe0234fe336211f5e44e18f3) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.210 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Source: Custom
Source -> Filter (3/6) (5c3fb959f79d53cdca506188ed40cc6d) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.230 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (1/6) (eb06b4212d17f10cf4a8bcc812eaa073) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.231 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (6/6) (1e66dc5791940cf7e213b1b3cf8cf1fd) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.245 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (5/6) (4cb656b991141acbbe9e1033103ab470) switched from
DEPLOYING to RUNNING.
2020-01-09 05:14:04.922 [flink-akka.actor.default-dispatcher-14] INFO
org.apache.flink.runtime.executiongraph.ExecutionGraph - Map -> Filter ->
Sink: Unnamed (3/6) (adb9b0aabe0234fe336211f5e44e18f3) switched from
RUNNING to FAILED.
java.lang.NullPointerException: null
at com.sogou.qidian.MyMapFunction2.map(MyMapFunction2.java:39)
at com.sogou.qidian.MyMapFunction2.map(MyMapFunction2.java:25)
at
org.apache.flink.streaming.api.operators.StreamMap.processElement(StreamMap.java:41)
at
org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processElement(StreamOneInputProcessor.java:164)
at
org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:143)
at
org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:279)
at
org.apache.flink.streaming.runtime.tasks.StreamTask.run(StreamTask.java:301)
at
org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:406)
at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:705)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:530)
at java.lang.Thread.run(Thread.java:748)

之后就是不停的循环,怪异的是 MyMapFunction2.java:39内容是


if (null != uniqMark.value() && uniqMark.value()) {

而报错的时间点距离任务启动差不多就是 12 小时,符合我设置的 valueState 的 ttl


@Override
public void open(Configuration parameters) throws Exception {
ValueStateDescriptor<Boolean> descriptor = new
ValueStateDescriptor<>("uniqMark",
TypeInformation.of(Boolean.class));
StateTtlConfig ttlConfig = StateTtlConfig.newBuilder(Time.hours(1))
.setUpdateType(UpdateType.OnCreateAndWrite)
.setStateVisibility(StateVisibility.ReturnExpiredIfNotCleanedUp)
.cleanupIncrementally(1000, false)
.build();
descriptor.enableTimeToLive(ttlConfig);
uniqMark = getRuntimeContext().getState(descriptor);
}

所以我猜测在什么极端情况下会出现 valueState 自身变为 null 的情况么?(比如刚刚被清理的瞬间)?

求各位指正*来自志愿者整理的flink邮件归档

展开
收起
船长的小螺号 2021-12-03 10:05:24 1135 0
1 条回答
写回答
取消 提交回答
  • 能贴一下MyMapFunction2.java:39 这里的代码吗? 从上面的日志看不出来是valueState是null呢。*来自志愿者整理的FLINK邮件归档

    2021-12-03 10:41:03
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Flink CDC Meetup PPT - 龚中强 立即下载
Flink CDC Meetup PPT - 王赫 立即下载
Flink CDC Meetup PPT - 覃立辉 立即下载