Die with dignity on the network layer#21720
Merged
jasontedor merged 2 commits intoelastic:masterfrom Nov 22, 2016
Merged
Conversation
When a fatal error is thrown on the network layer, such an error never makes its way to the uncaught exception handler. This prevents the node from being torn down if an out of memory error or other fatal error is thrown while handling HTTP or transport traffic. This commit adds logic to ensure that such errors bubble their way up to the uncaught exception handler, even though Netty tries really hard to swallow everything.
Member
Author
|
To test this, start an instance of Elasticsearch that does not have this patch applied with a 256m heap and Elasticsearch will not die. Now apply this patch and test again. Elasticsearch will die with: |
jaymode
approved these changes
Nov 21, 2016
Member
jaymode
left a comment
There was a problem hiding this comment.
left one comment. Other than that LGTM
| * frame so that at least we know where it came from. | ||
| */ | ||
| final StackTraceElement previous = Thread.currentThread().getStackTrace()[2]; | ||
| new Thread(() -> { throw (Error)cause; }, previous.getClassName() + "#" + previous.getMethodName()).start(); |
Member
There was a problem hiding this comment.
maybe we can try to log the stacktrace in a try-finally block in hopes that we can get the full stacktrace? In the finally we can throw the Error
Member
Author
|
retest this please |
When preparing to rethrow a fatal error, this commit adds an attempt to log the current stack trace so where know which handler saw the fatal error.
cb64c39 to
bf47916
Compare
jasontedor
added a commit
that referenced
this pull request
Nov 22, 2016
When a fatal error is thrown on the network layer, such an error never makes its way to the uncaught exception handler. This prevents the node from being torn down if an out of memory error or other fatal error is thrown while handling HTTP or transport traffic. This commit adds logic to ensure that such errors bubble their way up to the uncaught exception handler, even though Netty tries really hard to swallow everything. Relates #21720
jasontedor
added a commit
that referenced
this pull request
Nov 22, 2016
When a fatal error is thrown on the network layer, such an error never makes its way to the uncaught exception handler. This prevents the node from being torn down if an out of memory error or other fatal error is thrown while handling HTTP or transport traffic. This commit adds logic to ensure that such errors bubble their way up to the uncaught exception handler, even though Netty tries really hard to swallow everything. Relates #21720
Member
Author
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 a fatal error is thrown on the network layer, such an error never
makes its way to the uncaught exception handler. This prevents the node
from being torn down if an out of memory error or other fatal error is
thrown while handling HTTP or transport traffic. This commit adds logic
to ensure that such errors bubble their way up to the uncaught exception
handler, even though Netty tries really hard to swallow everything.
Relates #19272