MINOR: Fix ConsumerBounceTest to wait for consumer close#3334
MINOR: Fix ConsumerBounceTest to wait for consumer close#3334rajinisivaram wants to merge 1 commit intoapache:trunkfrom
Conversation
|
@ijuma Can you take a look (and merge if it is ok), please? Thank you! This is a fix for the failure in https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/5268/ |
|
Refer to this link for build results (access rights to CI server needed): |
|
Refer to this link for build results (access rights to CI server needed): |
ijuma
left a comment
There was a problem hiding this comment.
Thanks for the PR. I think the actual issue here is that we don't wait for the executor's tasks to terminate in the tearDown before we try to close the consumers. If we do that, then we should not have the issue reported here.
One of the get calls you added still seems worthwhile. The other one, I am less sure about.
| // consumer1 should leave group and close immediately even though rebalance is in progress | ||
| submitCloseAndValidate(consumer1, Long.MaxValue, None, Some(gracefulCloseTimeMs)) | ||
| val future1 = submitCloseAndValidate(consumer1, Long.MaxValue, None, Some(gracefulCloseTimeMs)) | ||
| future1.get |
There was a problem hiding this comment.
Is this needed? It seems like waitForRebalance would do the job, no?
| // consumer2 should close immediately without LeaveGroup request since there are no brokers available | ||
| submitCloseAndValidate(consumer2, Long.MaxValue, None, Some(0)) | ||
| val future2 = submitCloseAndValidate(consumer2, Long.MaxValue, None, Some(0)) | ||
| future2.get |
There was a problem hiding this comment.
Maybe we don't need a variable and we can just call get on the result?
| consumers.foreach(_.close()) | ||
| } finally { | ||
| super.tearDown() | ||
| } |
There was a problem hiding this comment.
This is a bit tricky. Maybe we should just leave as it was. The issue is that close throwing an exception is a bug and if we do the try/finally, we may obscure the original exception if super.tearDown itself throws an exception.
|
Closing this PR since the test was updated in commit 031da88. |
No description provided.