Skip to content

Conversation

@AndrewJSchofield
Copy link
Member

@AndrewJSchofield AndrewJSchofield commented Oct 23, 2025

The acknowledgement commit callback in the share consumer gets called on
the application thread at the start of the poll, commitSync and
commitAsync methods. Specifically in the peculiar case of using the
callback together with commitSync, the acknowledgement callback for the
committed records is called at the start of the next eligible call, even
though the information is already known at the end of the commitSync's
execution. The results are correct already, but the timing could be
improved in some situations.

Reviewers: Apoorv Mittal apoorvmittal10@gmail.com, Shivsundar R
shr@confluent.io

Copy link
Contributor

@apoorvmittal10 apoorvmittal10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor nit comment.

Copy link
Contributor

@ShivsundarR ShivsundarR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. LGTM!

@AndrewJSchofield AndrewJSchofield merged commit 87657fd into apache:trunk Oct 24, 2025
24 checks passed
@AndrewJSchofield AndrewJSchofield deleted the KAFKA-19827 branch October 24, 2025 07:56
joshua2519 pushed a commit to joshua2519/kafka that referenced this pull request Oct 27, 2025
…#20758)

The acknowledgement commit callback in the share consumer gets called on
the application thread at the start of the poll, commitSync and
commitAsync methods. Specifically in the peculiar case of using the
callback together with commitSync, the acknowledgement callback for the
committed records is called at the start of the next eligible call, even
though the information is already known at the end of the commitSync's
execution. The results are correct already, but the timing could be
improved in some situations.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Shivsundar R
<shr@confluent.io>
Comment on lines +615 to +619
try {
handleCompletedAcknowledgements(false);
} catch (Throwable t) {
log.warn("Exception thrown in acknowledgement commit callback", t);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this change make testShareGroupMaxSizeConfigExceeded become flaky.
The following code will fix this issue but seem to violate the comments.

// Handle any acknowledgements which completed while we were waiting, but do not throw
// the exception because the fetched records would then not be returned to the caller
try {
    handleCompletedAcknowledgements(false);
} catch (GroupMaxSizeReachedException e) {
    log.warn("Exception thrown in acknowledgement commit callback", e);
    throw e;
} catch (Throwable t) {
    log.warn("Exception thrown in acknowledgement commit callback", t);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TaiJuWu thanks for this find. The flaky behaviour and its root cause have already been logged in https://issues.apache.org/jira/browse/KAFKA-19840

eduwercamacaro pushed a commit to littlehorse-enterprises/kafka that referenced this pull request Nov 12, 2025
…#20758)

The acknowledgement commit callback in the share consumer gets called on
the application thread at the start of the poll, commitSync and
commitAsync methods. Specifically in the peculiar case of using the
callback together with commitSync, the acknowledgement callback for the
committed records is called at the start of the next eligible call, even
though the information is already known at the end of the commitSync's
execution. The results are correct already, but the timing could be
improved in some situations.

Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Shivsundar R
<shr@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants