-
Notifications
You must be signed in to change notification settings - Fork 127
LoomKafkaConsumer::close let closing task finish before interrupting #3957
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
LoomKafkaConsumer::close let closing task finish before interrupting #3957
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3957 +/- ##
=======================================
Coverage 48.24% 48.24%
=======================================
Files 246 246
Lines 14500 14500
=======================================
Hits 6995 6995
Misses 6799 6799
Partials 706 706 ☔ View full report in Codecov by Sentry. |
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!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maschmid, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test reconciler-tests-keda |
logger.debug("Queue is empty"); | ||
|
||
if (!isFinished.get()) { | ||
logger.debug("Background thread not finished yet, waiting for it to complete"); | ||
Thread.sleep(2000L); | ||
|
||
if (!isFinished.get()) { | ||
logger.debug("Background thread still not finished yet, interrupting background thread"); | ||
taskRunnerThread.interrupt(); | ||
} | ||
} | ||
|
||
taskRunnerThread.interrupt(); |
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.
We could also consider using "isFinished" in the while above?
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.
Right now I wanted to preserve the logic of "wait forever for all the tasks except the last one and then give 2s for the last task".
If we are OK to never interrupt, we could just wait until !isFinished.get()
@maschmid we might have the same issue here Lines 138 to 149 in 2b755b0
|
Seeing quite a lot of InterruptedExceptions when deleting triggers,
The LoomKafkaConsumer::close does not wait for the close task to finish before interrupting (it only waits for the queue to be empty, but it is empty while it's processing the last task)
Proposed Changes