conduktor.io ↗

Kafka Exception TaskCorruptedException

org.apache.kafka.streams.errors.TaskCorruptedException
Non-retriable Streams

Indicates a specific task is corrupted and need to be re-initialized. It can be thrown when: Under EOS, if the checkpoint file does not contain offsets for corresponding store's changelogs, meaning previously it was not close cleanly. Out-of-range exception thrown during restoration, meaning that the changelog has been modified and we re-bootstrap the store.

Common Causes

Solutions

Example Stack Trace

org.apache.kafka.streams.errors.TaskCorruptedException: Tasks [0_2] are corrupted and hence need to be re-initialized at org.apache.kafka.streams.processor.internals.StoreChangelogReader.restore(StoreChangelogReader.java:578) at org.apache.kafka.streams.processor.internals.TaskManager.tryToCompleteRestoration(TaskManager.java:660) at org.apache.kafka.streams.processor.internals.StreamThread.initializeAndRestorePhase(StreamThread.java:902) at org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:757) at org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:617) Caused by: org.apache.kafka.clients.consumer.OffsetOutOfRangeException: Fetch position FetchPosition{offset=15233} is out of range for partition my-app-store-changelog-2

Diagnostic Commands

kafka-get-offsets.sh --bootstrap-server localhost:9092 --topic my-app-store-changelog --time -2 # earliest offset vs the out-of-range position in the trace kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic my-app-store-changelog # verify cleanup.policy=compact and retention settings kafka-streams-application-reset.sh --application-id my-app --bootstrap-server localhost:9092 # plus delete local state.dir to force a clean rebuild after corruption

Related

Related Streams exceptions: BrokerNotFoundException · InternalTopicsAlreadySetupException · InvalidStateStoreException · InvalidStateStorePartitionException · LockException · MisconfiguredInternalTopicException · MissingInternalTopicsException · MissingSourceTopicException

Hitting TaskCorruptedException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.