-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Handle scheduler exceptions #38014
Merged
henningandersen
merged 3 commits into
elastic:master
from
henningandersen:handle_scheduler_exceptions
Jan 31, 2019
Merged
Handle scheduler exceptions #38014
henningandersen
merged 3 commits into
elastic:master
from
henningandersen:handle_scheduler_exceptions
Jan 31, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scheduler.schedule(...) would previously assume that caller handles exception by calling get() on the returned ScheduledFuture. schedule() now returns a ScheduledCancellable that no longer gives access to the exception. Instead, any exception thrown out of a scheduled Runnable is logged as a warning. This is a continuation of elastic#28667, elastic#36317 and also fixes elastic#37708.
henningandersen
added
>bug
:Core/Infra/Core
Core issues without another label
>breaking-java
v7.0.0
v6.7.0
labels
Jan 30, 2019
Pinging @elastic/es-core-infra |
ywelsch
suggested changes
Jan 30, 2019
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've done a first pass. Overall looking good.
qa/evil-tests/src/test/java/org/elasticsearch/threadpool/EvilThreadPoolTests.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/CancellableAdapter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/ScheduledCancellableAdapter.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/Scheduler.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/Scheduler.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/Scheduler.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/transport/TransportService.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/threadpool/SchedulerTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/threadpool/SchedulerTests.java
Outdated
Show resolved
Hide resolved
Fixed review comments: removed todo, use FutureUtils.cancel and removed scheduler task decoration since this adds more complexity than it benefits. This is a continuation of elastic#28667, elastic#36137 and also fixes elastic#37708.
henningandersen
force-pushed
the
handle_scheduler_exceptions
branch
from
January 30, 2019 15:24
4d7be7a
to
5042d7b
Compare
@elasticmachine please run elasticsearch-ci/2 |
ywelsch
approved these changes
Jan 30, 2019
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
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Jan 31, 2019
…ersion * elastic/master: Do not set up NodeAndClusterIdStateListener in test (elastic#38110) ML: better handle task state race condition (elastic#38040) Soft-deletes policy should always fetch latest leases (elastic#37940) Handle scheduler exceptions (elastic#38014) Minor logging improvements (elastic#38084) Fix Painless void return bug (elastic#38046) Update PutFollowAction serialization post-backport (elastic#37989) fix a few versionAdded values in ElasticsearchExceptions (elastic#37877) Reenable BWC tests after backport of elastic#37899 (elastic#38093) Mute failing test Mute failing test Fail start on obsolete indices documentation (elastic#37786) SQL: Implement FIRST/LAST aggregate functions (elastic#37936) Un-mute NoMasterNodeIT.testNoMasterActionsWriteMasterBlock remove unused parser fields in RemoteResponseParsers
henningandersen
added a commit
to henningandersen/elasticsearch
that referenced
this pull request
Feb 1, 2019
Scheduler.schedule(...) would previously assume that caller handles exception by calling get() on the returned ScheduledFuture. schedule() now returns a ScheduledCancellable that no longer gives access to the exception. Instead, any exception thrown out of a scheduled Runnable is logged as a warning. In this backport to 6.x, source backwards compatibility is maintained and some of the changes has therefore not been carried out (notably the signature change on Processor.Parameters.scheduler). This is a continuation of elastic#28667, elastic#36137 and also fixes elastic#37708.
henningandersen
added a commit
to henningandersen/elasticsearch
that referenced
this pull request
Feb 4, 2019
Instead of logging warnings we now rethrow exceptions thrown inside scheduled/submitted tasks. This will still log them as warnings in production but has the added benefit that if they are thrown during unit/integration test runs, the test will be flagged as an error. This is a continuation of elastic#38014
henningandersen
added a commit
to henningandersen/elasticsearch
that referenced
this pull request
Feb 5, 2019
Instead of logging warnings we now rethrow exceptions thrown inside scheduled/submitted tasks. This will still log them as warnings in production but has the added benefit that if they are thrown during unit/integration test runs, the test will be flagged as an error. Fixed NPE in GlobalCheckPointListners that caused CCR tests (IndexFollowingIT and likely others) to fail. This is a continuation of elastic#38014
henningandersen
added a commit
that referenced
this pull request
Feb 5, 2019
Instead of logging warnings we now rethrow exceptions thrown inside scheduled/submitted tasks. This will still log them as warnings in production but has the added benefit that if they are thrown during unit/integration test runs, the test will be flagged as an error. Fixed NPE in GlobalCheckPointListeners that caused CCR tests (IndexFollowingIT and likely others) to fail. This is a continuation of #38014 Backports #38317
henningandersen
added a commit
that referenced
this pull request
Feb 5, 2019
Instead of logging warnings we now rethrow exceptions thrown inside scheduled/submitted tasks. This will still log them as warnings in production but has the added benefit that if they are thrown during unit/integration test runs, the test will be flagged as an error. This is a continuation of #38014 Fixed NPE that caused CCR tests (IndexFollowingIT and likely others) to fail. schedule could bubble rejected exception to uncaught exception handler when not using SAME executor if thread pool is terminated. Now ignore rejected exception silently if executor is shutdown.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a continuation of #28667, #36137 and also fixes #37708. The goal is to log warnings on all exceptions thrown out of Runnables passed to Scheduler.schedule. There were no usages of the "Future.get()" on the ScheduledFuture returned from schedule and we have therefore redefined the semantics to be that scheduled tasks should never fail and if they do this should always be logged as a warning.
Parts of this will be backported to 6.x, notably we will avoid following breaking changes (breaking-java label only applies to 7.0):
Please pay special attention to the change in Processor.Parameters, I would like input on the todo in that file.