-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Add a plugin that adds a handler to crash the JVM #109930
Conversation
Pinging @elastic/es-core-infra (Team:Core/Infra) |
...nal-modules/jvm-crash/src/javaRestTest/java/org/elasticsearch/test/jvm_crash/JvmCrashIT.java
Outdated
Show resolved
Hide resolved
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.
One question: do you know if the JVM is treating its internal code differently from the "user" code (i.e. the bytecode that gets interpreted/JITed?)
This plugin may be useful anyway to test how we respond to a JVM crash, but the usefulness can be limited if it ends up that native uncaught exceptions are treated differently based on where/when they originated
...nal-modules/jvm-crash/src/javaRestTest/java/org/elasticsearch/test/jvm_crash/JvmCrashIT.java
Outdated
Show resolved
Hide resolved
Other bugs may cause |
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
...modules/jvm-crash/src/javaRestTest/java/org/elasticsearch/test/jvm_crash/TeePrintStream.java
Show resolved
Hide resolved
...nal-modules/jvm-crash/src/javaRestTest/java/org/elasticsearch/test/jvm_crash/JvmCrashIT.java
Show resolved
Hide resolved
private static void redirectStdout() { | ||
if (originalOut == null) { | ||
originalOut = System.out; | ||
stdOutput = new ByteArrayOutputStream(); |
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.
Why can't we read the output from disk? The test nodes have an es.out file that should contain the crash info?
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.
The JVM crash is only output to standard out (JVM knows nothing about log4j), the test-cluster.log
file doesn't have it
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.
es.out is not log4j, it's the stdout of the ES process.
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.
oof, I am mixing up testclusters and the new test framework. For things like gradlew run
we have es.out
, but it looks like the new cluster test framework starts the ES processes with inherited IO.
@mark-vieira is there a strong reason why the stdout/stderr is not captured via a file?
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 redirect stdout from the ES proccess to stdout in the test process so the crash should be captured in the test logs but perhaps not in a way that can be asserted on. If we need a general way to redirect logs to some other consumer we can certainly add an API for this use case. I think we've used the getNodeLog()
API for these use cases in the past but that obviously doesn't work for JVM level stuff that doesn't go through log4j.
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.
And also it's very rare to have something that goes to stdout/stderr that does not go through log4j
@elasticmachine update branch |
A rest handler that purposefully causes a hard JVM crash for testing purposes