8319053: Segment dump files remain after parallel heap dump on Windows
Reviewed-by: dholmes, yyang
This commit is contained in:
parent
ea6a88a0aa
commit
29cf2c471b
@ -389,7 +389,7 @@ enum {
|
||||
|
||||
// Supports I/O operations for a dump
|
||||
// Base class for dump and parallel dump
|
||||
class AbstractDumpWriter : public ResourceObj {
|
||||
class AbstractDumpWriter : public CHeapObj<mtInternal> {
|
||||
protected:
|
||||
enum {
|
||||
io_buffer_max_size = 1*M,
|
||||
@ -1955,7 +1955,9 @@ void DumpMerger::do_merge() {
|
||||
merge_file(path);
|
||||
}
|
||||
// Delete selected segmented heap file nevertheless
|
||||
remove(path);
|
||||
if (remove(path) != 0) {
|
||||
log_info(heapdump)("Removal of segment file (%d) failed (%d)", i, errno);
|
||||
}
|
||||
}
|
||||
|
||||
// restore compressor for further use
|
||||
@ -2358,6 +2360,7 @@ void VM_HeapDumper::work(uint worker_id) {
|
||||
_dumper_controller->wait_all_dumpers_complete();
|
||||
} else {
|
||||
_dumper_controller->dumper_complete(local_writer, writer());
|
||||
delete local_writer;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.JDKToolLauncher;
|
||||
@ -39,7 +41,7 @@ import jdk.test.lib.hprof.HprofParser;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8306441
|
||||
* @bug 8306441 8319053
|
||||
* @summary Verify the integrity of generated heap dump and capability of parallel dump
|
||||
* @library /test/lib
|
||||
* @run main HeapDumpParallelTest
|
||||
@ -47,6 +49,8 @@ import jdk.test.lib.hprof.HprofParser;
|
||||
|
||||
public class HeapDumpParallelTest {
|
||||
|
||||
private static final String heapDumpFileName = "parallelHeapDump.bin";
|
||||
|
||||
private static void checkAndVerify(OutputAnalyzer dcmdOut, LingeredApp app, File heapDumpFile, boolean expectSerial) throws Exception {
|
||||
dcmdOut.shouldHaveExitValue(0);
|
||||
dcmdOut.shouldContain("Heap dump file created");
|
||||
@ -65,6 +69,16 @@ public class HeapDumpParallelTest {
|
||||
appOut.shouldNotContain("Merge heap files complete");
|
||||
}
|
||||
HprofParser.parseAndVerify(heapDumpFile);
|
||||
|
||||
List<String> files
|
||||
= Stream.of(heapDumpFile.getAbsoluteFile().getParentFile().listFiles())
|
||||
.filter(file -> !file.isDirectory())
|
||||
.map(File::getName)
|
||||
.filter(name -> name.startsWith(heapDumpFileName) && !name.equals(heapDumpFileName))
|
||||
.collect(Collectors.toList());
|
||||
if (!files.isEmpty()) {
|
||||
throw new RuntimeException("Unexpected files left: " + files);
|
||||
}
|
||||
if (heapDumpFile.exists()) {
|
||||
heapDumpFile.delete();
|
||||
}
|
||||
@ -79,8 +93,6 @@ public class HeapDumpParallelTest {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String heapDumpFileName = "parallelHeapDump.bin";
|
||||
|
||||
File heapDumpFile = new File(heapDumpFileName);
|
||||
if (heapDumpFile.exists()) {
|
||||
heapDumpFile.delete();
|
||||
|
Loading…
Reference in New Issue
Block a user