-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Avoid class cast exception from index writer #28989
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
Merged
jasontedor
merged 1 commit into
elastic:master
from
jasontedor:index-writer-tragic-exception-class-cast-exception
Mar 12, 2018
Merged
Avoid class cast exception from index writer #28989
jasontedor
merged 1 commit into
elastic:master
from
jasontedor:index-writer-tragic-exception-class-cast-exception
Mar 12, 2018
Conversation
This file contains hidden or 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
When an index writer encounters a tragic exception, it could be a Throwable and not an Exception. Yet we blindly cast the tragic exception to an Exception which can encounter a ClassCastException. This commit addresses this by checking if the tragic exception is an Exception and otherwise wrapping the Throwable in a RuntimeException if it is not. We choose to wrap the Throwable instead of passing it around because passing it around leads to changing a lot of places where we handle Exception to handle Throwable instead. In general, we have tried to avoid handling Throwable and instead let those bubble up to the uncaught exception handler.
Collaborator
|
Pinging @elastic/es-distributed |
s1monw
approved these changes
Mar 12, 2018
jasontedor
added a commit
that referenced
this pull request
Mar 12, 2018
When an index writer encounters a tragic exception, it could be a Throwable and not an Exception. Yet we blindly cast the tragic exception to an Exception which can encounter a ClassCastException. This commit addresses this by checking if the tragic exception is an Exception and otherwise wrapping the Throwable in a RuntimeException if it is not. We choose to wrap the Throwable instead of passing it around because passing it around leads to changing a lot of places where we handle Exception to handle Throwable instead. In general, we have tried to avoid handling Throwable and instead let those bubble up to the uncaught exception handler.
jasontedor
added a commit
that referenced
this pull request
Mar 12, 2018
When an index writer encounters a tragic exception, it could be a Throwable and not an Exception. Yet we blindly cast the tragic exception to an Exception which can encounter a ClassCastException. This commit addresses this by checking if the tragic exception is an Exception and otherwise wrapping the Throwable in a RuntimeException if it is not. We choose to wrap the Throwable instead of passing it around because passing it around leads to changing a lot of places where we handle Exception to handle Throwable instead. In general, we have tried to avoid handling Throwable and instead let those bubble up to the uncaught exception handler.
jasontedor
added a commit
that referenced
this pull request
Mar 12, 2018
When an index writer encounters a tragic exception, it could be a Throwable and not an Exception. Yet we blindly cast the tragic exception to an Exception which can encounter a ClassCastException. This commit addresses this by checking if the tragic exception is an Exception and otherwise wrapping the Throwable in a RuntimeException if it is not. We choose to wrap the Throwable instead of passing it around because passing it around leads to changing a lot of places where we handle Exception to handle Throwable instead. In general, we have tried to avoid handling Throwable and instead let those bubble up to the uncaught exception handler.
jasontedor
added a commit
that referenced
this pull request
Mar 12, 2018
When an index writer encounters a tragic exception, it could be a Throwable and not an Exception. Yet we blindly cast the tragic exception to an Exception which can encounter a ClassCastException. This commit addresses this by checking if the tragic exception is an Exception and otherwise wrapping the Throwable in a RuntimeException if it is not. We choose to wrap the Throwable instead of passing it around because passing it around leads to changing a lot of places where we handle Exception to handle Throwable instead. In general, we have tried to avoid handling Throwable and instead let those bubble up to the uncaught exception handler.
bleskes
reviewed
Mar 12, 2018
Contributor
bleskes
left a comment
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. Good one!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
>bug
:Distributed Indexing/Engine
Anything around managing Lucene and the Translog in an open shard.
v5.6.9
v6.1.4
v6.2.3
v6.3.0
v7.0.0-beta1
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.
When an index writer encounters a tragic exception, it could be a
Throwableand not anException. Yet we blindly cast the tragic exception to anExceptionwhich can encounter aClassCastException. This commit addresses this by checking if the tragic exception is anExceptionand otherwise wrapping theThrowablein aRuntimeExceptionif it is not. We choose to wrap theThrowableinstead of passing it around because passing it around leads to changing a lot of places where we handleExceptionto handleThrowableinstead. In general, we have tried to avoid handlingThrowableand instead let those bubble up to the uncaught exception handler.