-
Notifications
You must be signed in to change notification settings - Fork 210
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
Add retry to make sure source is not shutdown when exceptions are thrown on the main thread #5029
Conversation
@@ -116,6 +116,11 @@ public void start(final Buffer<Record<Event>> buffer) { | |||
public void shutDown() { | |||
LOG.info("Stop request received for Kinesis Source"); | |||
|
|||
if (scheduler == null) { | |||
LOG.info("Scheduler not initialized!!"); |
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.
Let's avoid using exclamation marks unless we really need them.
LOG.info("Scheduler not initialized!!"); | |
LOG.info("The Kinesis Scheduler was not initialized."); |
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.
Thanks @dlvenable . I have addressed this.
@@ -116,6 +116,11 @@ public void start(final Buffer<Record<Event>> buffer) { | |||
public void shutDown() { | |||
LOG.info("Stop request received for Kinesis Source"); | |||
|
|||
if (scheduler == null) { | |||
LOG.info("Scheduler not initialized!!"); | |||
return; |
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.
I'm a little concerned about returning in this case. It may lead to errors down the line where we don't shut down other resources.
I tend to think this could would be better off with:
if(scheduler != null) {
// shutdown
} else {
// log
}
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.
Thanks @dlvenable . I have addressed this.
try { | ||
Thread.sleep(kinesisSourceConfig.getInitializationBackoffTime().toMillis()); | ||
} catch (InterruptedException e){ | ||
LOG.debug("Interrupted exception!"); |
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.
LOG.debug("Interrupted exception!"); | |
LOG.debug("Interrupted exception."); |
…own on the main thread Signed-off-by: Souvik Bose <[email protected]>
Signed-off-by: Souvik Bose <[email protected]>
69ac883
to
d6e5036
Compare
Description
It has been observed that If the pipeline role is missing Kinesis permissions, the source throws an exception resulting in a shutdown of the pipeline.
The fix is to add retry based on 2 configurations in KinesisSource:
This should help to make sure that the pipeline is not terminated when permissions are missing. With updated permissions, the pipeline should continue to initialize and function properly.
Issues Resolved
Resolves #1082
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.