Skip to content

KAFKA-14717 KafkaStreams can' get running if the rebalance happens be…#13248

Merged
guozhangwang merged 4 commits intoapache:trunkfrom
chia7712:KAFKA-14717
Feb 17, 2023
Merged

KAFKA-14717 KafkaStreams can' get running if the rebalance happens be…#13248
guozhangwang merged 4 commits intoapache:trunkfrom
chia7712:KAFKA-14717

Conversation

@chia7712
Copy link
Copy Markdown
Member

I noticed this issue when tracing #12590
StreamThread closes the consumer before changing state to DEAD. If the partition rebalance happens quickly, the other StreamThreads can't change KafkaStream state from REBALANCING to RUNNING since there is a PENDING_SHUTDOWN StreamThread

Committer Checklist (excluded from commit message)

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

Copy link
Copy Markdown
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

Thanks @chia7712 for the find! After digging it I agree this is a real issue. Though I have some questions about the fix itself, and also about the test covering this scenario. Please let me know what do you think?

final Properties prop = new Properties();
prop.putAll(properties);
// make rebalance happen quickly
prop.put(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, 200);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a better way to test this scenario than relying on the real time (and hence is time dependendent)? More specifically, I'm looking for a test case which would 100% fail without the fix, and would 100% pass with the fix. While this test seems would be pass some times even without the fix, is that right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

While this test seems would be pass some times even without the fix, is that right?

you are right. I have updated the test to make sure it is always failed without the fix.

Comment thread streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java Outdated
@guozhangwang guozhangwang merged commit 7e14999 into apache:trunk Feb 17, 2023
@guozhangwang
Copy link
Copy Markdown
Contributor

LGTM. Merged to trunk.

@chia7712 chia7712 deleted the KAFKA-14717 branch March 25, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants