Skip to content
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

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

zachjhum
Copy link
Contributor

@zachjhum zachjhum commented Feb 19, 2024

This fix deals with a customer issue where the KCL logs an IllegalStateException during even a graceful worker shutdown. See #914

@akidambisrinivasan
Copy link
Contributor

_ No description provided. _

Please keep a short title for the commit but move the explanation and details to the description section

@zachjhum zachjhum changed the title Move throwOnIllegalState call to drain queue method to prevent improper error logging during worker shutdown Prevent improper error logging during worker shutdown Feb 19, 2024
@@ -377,13 +380,27 @@ record = Record.builder().data(createByteBufferWithSize(1024)).build();
@Test(expected = IllegalStateException.class)
public void testGetNextRecordsWithoutStarting() {
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, maybe testRequestRecordsOnSubscriptionAfterShutdown

@zachjhum
Copy link
Contributor Author

Tested with a KCL application. On subscribe (which happens during startup) or lease loss, did not see the exception logged.

@zachjhum zachjhum merged commit 5f3de14 into awslabs:master Feb 21, 2024
1 check passed
akidambisrinivasan pushed a commit to akidambisrinivasan/amazon-kinesis-client that referenced this pull request Apr 29, 2024
* 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
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.

None yet

2 participants