-
Notifications
You must be signed in to change notification settings - Fork 25k
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
scheduleAtFixedRate would hang #42993
scheduleAtFixedRate would hang #42993
Conversation
Though not in use in elasticsearch currently, it seems surprising that ThreadPool.scheduler().scheduleAtFixedRate would hang. A recurring scheduled task is never completed (except on failure) and we test for exceptions using RunnableFuture.get(), which hangs for periodic tasks. Fixed by checking that task is done before calling .get(). Related to elastic#38441
Pinging @elastic/es-core-infra |
@@ -276,7 +277,11 @@ protected void afterExecute(Runnable r, Throwable t) { | |||
if (t != null) return; | |||
// Scheduler only allows Runnable's so we expect no checked exceptions here. If anyone uses submit directly on `this`, we | |||
// accept the wrapped exception in the output. | |||
ExceptionsHelper.reThrowIfNotNull(EsExecutors.rethrowErrors(r)); | |||
if (r instanceof RunnableFuture && ((RunnableFuture<?>) r).isDone()) { |
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 move the isDone
condition to EsExecutors.rethrowErrors
instead? Or should we alternatively assert isDone
there? This will possibly cover other (and future) occurrences of this as well
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 added the assertion in 3781c31, since moving the check to EsExecutors.rethrowErrors
would mean that we would silently ignore if isDone was false also for non scheduled cases.
Thanks @ywelsch , this is ready for another round. |
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.
LGTM
…ule_at_fixed_rate_deadlock
Though not in use in elasticsearch currently, it seems surprising that ThreadPool.scheduler().scheduleAtFixedRate would hang. A recurring scheduled task is never completed (except on failure) and we test for exceptions using RunnableFuture.get(), which hangs for periodic tasks. Fixed by checking that task is done before calling .get().
Though not in use in elasticsearch currently, it seems surprising that ThreadPool.scheduler().scheduleAtFixedRate would hang. A recurring scheduled task is never completed (except on failure) and we test for exceptions using RunnableFuture.get(), which hangs for periodic tasks. Fixed by checking that task is done before calling .get().
Though not in use in elasticsearch currently, it seems surprising that ThreadPool.scheduler().scheduleAtFixedRate would hang. A recurring scheduled task is never completed (except on failure) and we test for exceptions using RunnableFuture.get(), which hangs for periodic tasks. Fixed by checking that task is done before calling .get().
Though not in use in elasticsearch currently, it seems surprising that
ThreadPool.scheduler().scheduleAtFixedRate would hang. A recurring
scheduled task is never completed (except on failure) and we test for
exceptions using RunnableFuture.get(), which hangs for periodic tasks.
Fixed by checking that task is done before calling .get().
Related to #38441