-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent improper error logging during worker shutdown #1257
Conversation
…er error logging during worker shutdown
Please keep a short title for the commit but move the explanation and details to the description section |
@@ -377,13 +380,27 @@ record = Record.builder().data(createByteBufferWithSize(1024)).build(); | |||
@Test(expected = IllegalStateException.class) | |||
public void testGetNextRecordsWithoutStarting() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh can we please change the test name to reflect what it is doing : testSubscribeWithouStarting
@@ -377,13 +380,27 @@ record = Record.builder().data(createByteBufferWithSize(1024)).build(); | |||
@Test(expected = IllegalStateException.class) | |||
public void testGetNextRecordsWithoutStarting() { | |||
verify(executorService, never()).execute(any()); | |||
getRecordsCache.drainQueueForRequests(); | |||
Subscriber<RecordsRetrieved> mockSubscriber = mock(Subscriber.class); | |||
getRecordsCache.subscribe(mockSubscriber); | |||
} | |||
|
|||
@Test(expected = IllegalStateException.class) | |||
public void testCallAfterShutdown() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, maybe testRequestRecordsOnSubscriptionAfterShutdown
Tested with a KCL application. On subscribe (which happens during startup) or lease loss, did not see the exception logged. |
* Move throwOnIllegalState call to drain queue method to prevent improper error logging during worker shutdown * Fix unit tests that expected IllegalStateException thrown * Changed names of unit tests to reflect new behavior
This fix deals with a customer issue where the KCL logs an IllegalStateException during even a graceful worker shutdown. See #914