Hello all, I am using Flink with kinesis and facin...
# troubleshooting
l
Hello all, I am using Flink with kinesis and facing this, have anyone faced something similar or has any clue what can be the reason? We use flink 1.16 with java 8 This cause our job to restart
Copy code
2023-02-28 11:48:55,553 INFO  org.apache.flink.streaming.connectors.kinesis.internals.KinesisDataFetcher [] {} - Starting shutdown of shard consumer threads and AWS SDK resources of subtask 0 ...
java.lang.InterruptedException: null
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014) ~[?:1.8.0_362]
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2088) ~[?:1.8.0_362]
	at java.util.concurrent.ThreadPoolExecutor.awaitTermination(ThreadPoolExecutor.java:1475) ~[?:1.8.0_362]
	at org.apache.flink.streaming.connectors.kinesis.internals.KinesisDataFetcher.awaitTermination(KinesisDataFetcher.java:875) ~[cdp-flink-jobs.jar:?]
	at org.apache.flink.streaming.connectors.kinesis.internals.KinesisDataFetcher.runFetcher(KinesisDataFetcher.java:760) ~[cdp-flink-jobs.jar:?]
	at org.apache.flink.streaming.connectors.kinesis.FlinkKinesisConsumer.run(FlinkKinesisConsumer.java:392) ~[cdp-flink-jobs.jar:?]
	at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110) ~[flink-dist-1.16.1.jar:1.16.1]
	at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:67) ~[flink-dist-1.16.1.jar:1.16.1]
	at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:333) ~[flink-dist-1.16.1.jar:1.16.1]
2023-02-28 11:48:55,553 INFO  org.apache.flink.streaming.connectors.kinesis.internals.KinesisDataFetcher [] {} - Starting shutdown of shard consumer threads and AWS SDK resources of subtask 3 ...
j
how many shards in your KDS vs how many parallel instances of your KinesisConsumer?
l
we have 5 shards and and 4 consumers
2 jobs consume the kinesis stream and we have 2 pods for each job
j
Do you see any throughput exceptions on the source kinesis data stream?
l
we had that but after increaseing the interval for fetching the recods we stop having provisionexception but that error pesisted
j
Do you have any idle shards (with no data in them)
l
they all have data
j
Is this the full stack trace? Can you share anything more
we have more, so basically the job process some event and then when it tries to save the checkpoint it fails with that error
and then the job recover and starts to process the vents again.
j
ah so this happens on checkpointing, right?
l
yes
seems like
d
Seems like the job is already cancelling: •
2023-02-28 14:36:39,177 INFO org.apache.flink.runtime.taskmanager.Task [] {} - Attempting to cancel task Source:
Are you saying this Kinesis error is preventing the job from stopping gracefully, or is the root cause of the job failure?
l
i dont see any kinesis error before the error happens
d
Why is the job transitioning to CANCELLING though? What does the Flink dashboard show for job failure exception?
Is this failing for general checkpoint or when you try to stop-with-savepoint?
l
general checkpoint
I see this
Copy code
org.apache.flink.util.FlinkRuntimeException: Exceeded checkpoint tolerable failure threshold.
	at org.apache.flink.runtime.checkpoint.CheckpointFailureManager.checkFailureAgainstCounter(CheckpointFailureManager.java:206)
	at org.apache.flink.runtime.checkpoint.CheckpointFailureManager.handleJobLevelCheckpointException(CheckpointFailureManager.java:169)
	at org.apache.flink.runtime.checkpoint.CheckpointFailureManager.handleCheckpointException(CheckpointFailureManager.java:122)
	at org.apache.flink.runtime.checkpoint.CheckpointCoordinator.abortPendingCheckpoint(CheckpointCoordinator.java:2104)
	at org.apache.flink.runtime.checkpoint.CheckpointCoordinator.abortPendingCheckpoint(CheckpointCoordinator.java:2083)
	at org.apache.flink.runtime.checkpoint.CheckpointCoordinator.access$700(CheckpointCoordinator.java:98)
	at org.apache.flink.runtime.checkpoint.CheckpointCoordinator$CheckpointCanceller.run(CheckpointCoordinator.java:2165)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
d
ok, so the Kinesis error does not look like the root cause here, it looks like a symptom. Can you find in the logs the root cause for the checkpoint exception? The Kinesis error is thrown during shutdown "Starting shutdown of shard consumer threads and AWS SDK resources of subtask 1 ...", thus you need to identify what caused the shutdown. Granted there might still be a bug here though