KAFKA-18653: Fix mocks and potential thread leak issues causing silent RejectedExecutionException in share group broker tests#18725
Conversation
apoorvmittal10
left a comment
There was a problem hiding this comment.
Mostly looks good, some queries.
|
Test failures are unrelated. |
apoorvmittal10
left a comment
There was a problem hiding this comment.
Thanks for the changes, looking good. Some comments.
apoorvmittal10
left a comment
There was a problem hiding this comment.
Thanks for the fixes, LGTM!
AndrewJSchofield
left a comment
There was a problem hiding this comment.
A couple of tiny points. The logs from the already passing test runs are much cleaner with these mocking changes.
| * the records are fetched and acquired. | ||
| * | ||
| * @return A boolean which indicates whether the fetch lock is acquired. | ||
| * Visible for testing. |
There was a problem hiding this comment.
If you look at the javadoc, this sentence is part of the description for the return value. Either remove "Visible for testing" (preferred) or make sure it fits in the javadoc more nicely.
There was a problem hiding this comment.
I have removed "Visible for testing"
|
|
||
| DelayedShareFetch( | ||
| /** | ||
| * This function returns an instance of delayed share fetch operation for completing share fetch requests instantaneously or with delay. |
There was a problem hiding this comment.
Constructs rather than returns I think.
…ibrdkafka-compressed-produce-fails * apache-github/trunk: MINOR: prevent exception from HdrHistogram (apache#18674) KAFKA-18653: Fix mocks and potential thread leak issues causing silent RejectedExecutionException in share group broker tests (apache#18725) KAFKA-18646: Null records in fetch response breaks librdkafka (apache#18726) KAFKA-18619: New consumer topic metadata events should set requireMetadata flag (apache#18668) KAFKA-18488: Improve KafkaShareConsumerTest (apache#18728)
| @Test | ||
| def testDelayedShareFetchPurgatoryOperationExpiration(): Unit = { | ||
| val mockLogMgr = TestUtils.createLogManager(config.logDirs.map(new File(_))) | ||
| val rm = new ReplicaManager( |
There was a problem hiding this comment.
As a reminder, it's crucial to utilize a try-finally block to ensure proper closure of the ReplicaManager. Failing to do so can result in an unreleased thread from the purgatory, potentially leading to errors in subsequent integration tests that incorporate thread leak detection.
org.opentest4j.AssertionFailedError: Found 1 unexpected threads during @BeforeAll: executor-ShareFetch ==> expected: <true> but was: <false>
Also, the error can be reproduced by following command.
./gradlew core:test --tests ReplicaManagerTest --tests SaslApiVersionsRequestTest --tests LeaderEpochIntegrationTest --tests RequestQuotaTest -PmaxParallelForks=1
I will fix it in https://issues.apache.org/jira/browse/KAFKA-18770
There was a problem hiding this comment.
Apologies, I missed it in review. Should have caught it.
…t RejectedExecutionException in share group broker tests (apache#18725) Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Andrew Schofield <aschofield@confluent.io>
…t RejectedExecutionException in share group broker tests (apache#18725) Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Andrew Schofield <aschofield@confluent.io>
What
SharePartitionManagertests.SharePartitionMangerTestsuite locally, we can observetestReplicaManagerFetchShouldNotProceedandtestPendingInitializationShouldCompleteFetchRequestthrowing silent RejectedExecutionException.