The CheckpointCoordinator is failing to shut down cleanly during job recovery, preventing the job from resuming. This usually happens because a background thread or an asynchronous operation within the CheckpointCoordinator is still active when the shutdown signal is received, leading to a deadlock or an unhandled exception.

Common Causes and Fixes

  1. Stuck CompletableFuture in CheckpointCoordinator’s internal state:

    • Diagnosis: Examine Flink logs for CheckpointCoordinator threads that are blocked indefinitely or show signs of being stuck in CompletableFuture.get() or similar blocking calls. Look for messages indicating timeouts during checkpoint completion or recovery phases.
    • Fix: This often requires a Flink code change to ensure CompletableFutures are properly cancelled or their results are handled gracefully during shutdown. In a deployed environment, the most practical immediate fix is to increase the checkpoint timeout (execution.checkpointing.timeout) to give the system more time to complete ongoing operations before considering them failed. Set it to a value like 5m (5 minutes) or 10m.
    • Why it works: A longer timeout allows potentially slow asynchronous operations to finish naturally, avoiding the scenario where the CheckpointCoordinator tries to shut down while a future is still pending.
  2. External System Unresponsiveness during Checkpoint/Recovery:

    • Diagnosis: Check logs for timeouts or errors related to the state backend (e.g., S3, HDFS, RocksDB). If your state backend is slow or unresponsive, Flink’s checkpointing and recovery processes can hang. Look for IOExceptions or TimeoutExceptions originating from the state backend client.
    • Fix:
      • For S3: Increase S3 client timeouts. In flink-conf.yaml, set s3.client.connection.timeout: 60000 (60 seconds) and s3.client.socket.timeout: 120000 (120 seconds).
      • For HDFS: Ensure HDFS NameNode and DataNodes are healthy and responsive. Check network latency between Flink TaskManagers and HDFS.
      • For RocksDB: If using RocksDB, ensure sufficient disk IOPS and memory. Consider increasing taskmanager.memory.managed.off-heap.size if memory is a bottleneck for RocksDB state.
    • Why it works: By increasing timeouts or ensuring the underlying storage is performant, you prevent Flink from waiting indefinitely on a slow external resource, which can then cause the CheckpointCoordinator to fail during its shutdown sequence.
  3. Blocking I/O in CheckpointCoordinator’s Threads:

    • Diagnosis: Thread dumps of the Flink JobManager during the recovery phase might reveal threads within the CheckpointCoordinator or related services (like state backend serializers) stuck on blocking I/O operations (e.g., FileInputStream.read, FileOutputStream.write, network socket reads/writes).
    • Fix: This is often a symptom of underlying system issues (network, disk). Ensure network connectivity is stable and disks are not saturated. If it’s related to serialization, consider increasing the JVM heap size for the JobManager if it’s a memory-bound serialization issue, or optimize your state serialization format. For example, if using Kryo, ensure necessary serializers are registered.
    • Why it works: Unblocking the I/O operations allows the threads to proceed and complete their tasks, enabling a clean shutdown of the CheckpointCoordinator.
  4. Resource Contention on the JobManager:

    • Diagnosis: High CPU utilization or excessive garbage collection (GC) pauses on the JobManager can delay or halt the CheckpointCoordinator’s shutdown process. Monitor JobManager metrics for CPU load and GC activity.
    • Fix:
      • Increase JobManager memory: Allocate more heap space to the JobManager. In flink-conf.yaml, increase jobmanager.memory.heap.size, e.g., 4g or 8g.
      • Optimize Flink configuration: Review other Flink configurations that might be causing excessive load on the JobManager, such as too many concurrent submissions or very frequent state snapshotting on a small cluster.
    • Why it works: Providing sufficient resources ensures the JobManager can process shutdown requests promptly and execute the necessary cleanup logic without being bogged down by other JVM activities.
  5. Bug in Flink’s CheckpointCoordinator Shutdown Logic (Older Versions):

    • Diagnosis: If you’re on a significantly older Flink version (e.g., 1.x), there might be known bugs in the shutdown handling of the CheckpointCoordinator. Check Flink’s JIRA for reported issues related to CheckpointCoordinator shutdown or job recovery failures in your specific version.
    • Fix: Upgrade Flink to a more recent, stable version. For example, upgrading from Flink 1.13 to 1.16 or later often resolves many such stability issues.
    • Why it works: Newer versions contain bug fixes and improvements to the internal coordination and shutdown mechanisms, making them more robust.
  6. Asynchronous State Migration/Upgrade Issues:

    • Diagnosis: If you recently upgraded your Flink version or changed your state backend, and the job is attempting to recover with an incompatible state format, the CheckpointCoordinator might encounter errors during state deserialization or migration, leading to its failure. Look for deserialization errors or warnings about state format compatibility in the logs.
    • Fix: Ensure you are following the recommended state migration procedures for your Flink version. This might involve running a Flink upgrade job with specific flags or manually migrating state if required. If migrating from one state backend to another (e.g., from filesystem to S3), ensure the old state is fully accessible and compatible or that a clean state is used if migration is not feasible.
    • Why it works: Correct state migration ensures that the CheckpointCoordinator can properly access and process the existing state during recovery, preventing errors that could halt its shutdown.

The next error you’ll likely encounter if this is not fixed is a JobException or IllegalStateException indicating that the job could not be recovered, often with a message like "Job has failed and cannot be restarted."

Want structured learning?

Take the full Flink course →