8198337: -XX:StartFlightRecording=dumponexit=true,disk=false doesn't work

Reviewed-by: mgronlun
This commit is contained in:
Erik Gahlin 2018-05-21 14:46:12 +02:00
parent 8f71718566
commit e2fb68680e
3 changed files with 12 additions and 5 deletions

View File

@ -245,7 +245,7 @@ public final class PlatformRecorder {
RequestEngine.doChunkBegin();
}
synchronized void stop(PlatformRecording recording) {
synchronized void stop(PlatformRecording recording, WriteableUserPath alternativePath) {
RecordingState state = recording.getState();
if (Utils.isAfter(state, RecordingState.RUNNING)) {
@ -278,7 +278,7 @@ public final class PlatformRecorder {
}
} else {
// last memory
dumpMemoryToDestination(recording);
dumpMemoryToDestination(recording, alternativePath);
}
jvm.endRecording_();
disableEvents();
@ -314,8 +314,8 @@ public final class PlatformRecorder {
}
}
private void dumpMemoryToDestination(PlatformRecording recording) {
WriteableUserPath dest = recording.getDestination();
private void dumpMemoryToDestination(PlatformRecording recording, WriteableUserPath alternativePath) {
WriteableUserPath dest = alternativePath != null ? alternativePath : recording.getDestination();
if (dest != null) {
MetadataRepository.getInstance().setOutput(dest.getText());
recording.clearDestination();

View File

@ -161,7 +161,7 @@ public final class PlatformRecording implements AutoCloseable {
stopTask.cancel();
stopTask = null;
}
recorder.stop(this);
recorder.stop(this, alternativePath);
String endTExt = reason == null ? "" : ". Reason \"" + reason + "\".";
Logger.log(LogTag.JFR, LogLevel.INFO, "Stopped recording \"" + recording.getName() + "\" (" + recording.getId()+ ")" + endTExt);
this.stopTime = Instant.now();

View File

@ -56,6 +56,13 @@ public class TestDumpOnExit {
"-XX:StartFlightRecording=filename=./dumped.jfr,dumponexit=true,settings=profile",
"jdk.jfr.startupargs.TestDumpOnExit$TestMain"
);
// Test a memory recording without a security manager
testDumponExit(() -> findJFRFileInCurrentDirectory(),
"-Xlog:jfr=trace",
"-XX:StartFlightRecording=dumponexit=true,disk=false",
"jdk.jfr.startupargs.TestDumpOnExit$TestMain"
);
// Test with security manager and a file name relative to current directory
testDumponExit(() -> dumpPath,
"-Xlog:jfr=trace",