Skip to content

KAFKA-7501: fix producer batch double deallocation when receiving message too large error on expired batch#5807

Merged
ijuma merged 2 commits intoapache:trunkfrom
xiowu0:doubleDeallocation
Oct 22, 2018
Merged

KAFKA-7501: fix producer batch double deallocation when receiving message too large error on expired batch#5807
ijuma merged 2 commits intoapache:trunkfrom
xiowu0:doubleDeallocation

Conversation

@xiowu0
Copy link
Copy Markdown
Contributor

@xiowu0 xiowu0 commented Oct 16, 2018

Kafka will try to deallocate a batch twice and throw IllegalStateException when a "MESSAGE_TOO_LARGE" response arrived after the inflight batch is expired. This patch fixes the issue.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Oct 20, 2018

retest this please

@ijuma ijuma requested a review from becketqin October 20, 2018 17:06
Copy link
Copy Markdown
Member

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Nice catch and thanks for including the test. I left one suggestion to improve the readability of the code (existing issue) and maybe we can take the chance to remove the unused expiryErrorMessage in ProducerBatch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we please add a method isDone which is basically finalState() != null) and then use it here and everywhere else we do batch.finalState() == null? It would be much easier to understand.

@ijuma ijuma self-assigned this Oct 20, 2018
@ijuma
Copy link
Copy Markdown
Member

ijuma commented Oct 20, 2018

@becketqin if you have time, please take a look.

@lindong28 lindong28 self-assigned this Oct 20, 2018
@lindong28 lindong28 self-requested a review October 20, 2018 20:46
@lindong28 lindong28 removed their assignment Oct 20, 2018
Copy link
Copy Markdown
Member

@lindong28 lindong28 left a comment

Choose a reason for hiding this comment

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

The patch LGTM after addressing Ismael's comment.

Copy link
Copy Markdown
Member

@lindong28 lindong28 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 fix! LGTM after addressing Ismael's comment.

Copy link
Copy Markdown
Member

@lindong28 lindong28 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 fix! LGTM after addressing Ismael's comment.

Copy link
Copy Markdown
Member

@lindong28 lindong28 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 fix! LGTM after addressing Ismael's comment.

Copy link
Copy Markdown
Member

@lindong28 lindong28 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 fix! LGTM after addressing Ismael's comment.

xiowu0 and others added 2 commits October 21, 2018 22:59
…sage too large error on expired batch

Kafka will try to deallocate a batch twice and throw IllegalStateException when a "MESSAGE_TOO_LARGE" response arrived after the inflight batch is expired. This patch fixes the issue.
@ijuma ijuma force-pushed the doubleDeallocation branch from 8114bd6 to 0f02236 Compare October 22, 2018 06:18
@ijuma
Copy link
Copy Markdown
Member

ijuma commented Oct 22, 2018

I pushed a commit to the upstream branch with the suggested changes: xiowu0@0f02236

Not sure why it's not showing in the PR though.

Copy link
Copy Markdown
Member

@lindong28 lindong28 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 after Ismael's comment is addressed.

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Oct 22, 2018

GitHub is having some issues according to their status page, but my commit is now showing. @lindong28, does it look good to you?

@ijuma ijuma merged commit fed27fd into apache:trunk Oct 22, 2018
ijuma pushed a commit that referenced this pull request Oct 22, 2018
…sage too large error on expired batch (#5807)

Minor clean-ups for clarity included.

Reviewers: Dong Lin <lindong28@gmail.com>, Ismael Juma <ismael@juma.me.uk>
@ijuma
Copy link
Copy Markdown
Member

ijuma commented Oct 22, 2018

JDK 8 build passed, failures in JDK 11 build are unrelated. Merging to trunk and 2.1 branches. I originally planned to cherry-pick to 2.0, but there were some conflicts, so decided against it.

@xiowu0
Copy link
Copy Markdown
Contributor Author

xiowu0 commented Oct 22, 2018

Thanks for review @lindong28 @ijuma. I don't have a chance to make the suggested change during weekend, thanks for the minor tweak @ijuma.

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Oct 22, 2018

No worries! I did that because I wanted to include it in the upcoming 2.1.0 RC. :)

jonlee2 pushed a commit to linkedin/kafka that referenced this pull request Jan 8, 2019
…sage too large error on expired batch (apache#5807)

Minor clean-ups for clarity included.

Reviewers: Dong Lin <lindong28@gmail.com>, Ismael Juma <ismael@juma.me.uk>
pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
…sage too large error on expired batch (apache#5807)

Minor clean-ups for clarity included.

Reviewers: Dong Lin <lindong28@gmail.com>, Ismael Juma <ismael@juma.me.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants