-
Notifications
You must be signed in to change notification settings - Fork 15.1k
KAFKA-20403 : streams - Fix stream threads interruptions #21970
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
base: trunk
Are you sure you want to change the base?
Changes from all commits
d5ce5c3
db8d98c
ec7d231
aeb9960
cf989bf
1d7df45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,8 +147,7 @@ public void awaitProcessableTasks(final Supplier<Boolean> isShuttingDown) throws | |
| log.debug("Not awaiting since shutdown was requested"); | ||
| } | ||
| } catch (final InterruptedException ignored) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider handling InterruptedException in waitIfAllChangelogsCompletelyRead the same way as the other sites: Thread.currentThread().interrupt() (+ optional warn).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That path (
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if I follow the argument? In the end, KS code does not call I was digging around a little bit, and found other existing code doing: So maybe we should follow this pattern everywhere (maybe except in shutdown code path)? Or, considering the comment below: We might want to always handle
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree we should still handle interrupts defensively here. For waitIfAllChangelogsCompletelyRead, IMHO graceful handling (restore interrupt + leave the await() loop) is preferable over the fatal IllegalStateException style. Shutdown already uses isRunning + signalAll(), and this is an idle condition wait, not a “must complete this step” path.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree with being consistent. Updated with interrupt here |
||
| // we interrupt the thread for shut down and pause. | ||
| // we can ignore this exception. | ||
| Thread.currentThread().interrupt(); | ||
| log.debug("Await unblocked: Interrupted while waiting for processable tasks"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also be a warn-log?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we could keep debug as it is expected to shutdown or pause ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Digging into the code, I am actually not sure when we would interrupt a thread, so I am a little bit unsure about the existing comment...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That looks like a pre-existing comment. I have removed it. And for the await unblock, as it is not an error, log.debug is better than log.warn ? |
||
| return true; | ||
| } | ||
|
|
||
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.
Should we add a warn-log?