KAFKA-16876: TaskManager.handleRevocation doesn't handle errors thrown from task.prepareCommit#22282
Open
gabriellefu wants to merge 4 commits into
Open
KAFKA-16876: TaskManager.handleRevocation doesn't handle errors thrown from task.prepareCommit#22282gabriellefu wants to merge 4 commits into
gabriellefu wants to merge 4 commits into
Conversation
…o avoid leave the task at running
frankvicky
reviewed
May 15, 2026
| } catch (final RuntimeException e) { | ||
| log.error("Exception caught while post-committing task " + task.id(), e); | ||
| maybeSetFirstException(false, maybeWrapTaskException(e, task.id()), firstException); | ||
| log.error("Exception caught while preparing to commit revoked tasks " + revokedActiveTasks, e); |
Contributor
There was a problem hiding this comment.
Please replace with parametrised message.
| dirtyTasks.addAll(consumedOffsetsPerTask.keySet()); | ||
| closeDirtyAndRevive(dirtyTasks, false); | ||
| } catch (final RuntimeException e) { | ||
| log.error("Exception caught while committing those revoked tasks " + revokedActiveTasks, e); |
| // the task is in RUNNING tate | ||
| task.postCommit(false); | ||
| } catch (final RuntimeException e) { | ||
| log.error("Exception caught while post-committing task " + task.id(), e); |
| try { | ||
| task.suspend(); | ||
| } catch (final RuntimeException e) { | ||
| log.error("Caught the following exception while trying to suspend revoked task " + task.id(), e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
even when prepareCommit throws (e.g. TaskMigratedException from
producer.send during cache flush). Previously the exception propagated
uncaught, skipping the suspend loop entirely. This left tasks in RUNNING
state, which caused a downstream IllegalStateException when
handleAssignment tried to close them.
task unlock are guaranteed to execute regardless of where an exception
occurs.
dropping later exceptions. The first exception remains the primary
thrown exception for backward compatibility, but subsequent exceptions
(e.g. the IllegalStateException from closing an unsuspended task) are
now attached as suppressed exceptions instead of lost.