# HG changeset patch # User thartmann # Date 1416985618 -3600 # Node ID ecccc23346febcd3ecbeba08e9e2a80ae8041b16 # Parent 97f4214e9a703387e2ed04b28036c8876a584f89 8007993: hotspot.log w/ enabled LogCompilation can be an invalid XML Summary: Open compilation log files in write-mode and close before deletion attempt. Reviewed-by: vlivanov diff -r 97f4214e9a70 -r ecccc23346fe src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Mon Dec 01 09:38:52 2014 -0500 +++ b/src/share/vm/compiler/compileBroker.cpp Wed Nov 26 08:06:58 2014 +0100 @@ -1845,7 +1845,7 @@ os::file_separator(), thread_id, os::current_process_id()); } - fp = fopen(file_name, "at"); + fp = fopen(file_name, "wt"); if (fp != NULL) { if (LogCompilation && Verbose) { tty->print_cr("Opening compilation log %s", file_name); diff -r 97f4214e9a70 -r ecccc23346fe src/share/vm/compiler/compileLog.cpp --- a/src/share/vm/compiler/compileLog.cpp Mon Dec 01 09:38:52 2014 -0500 +++ b/src/share/vm/compiler/compileLog.cpp Wed Nov 26 08:06:58 2014 +0100 @@ -55,8 +55,10 @@ } CompileLog::~CompileLog() { - delete _out; + delete _out; // Close fd in fileStream::~fileStream() _out = NULL; + // Remove partial file after merging in CompileLog::finish_log_on_error + unlink(_file); FREE_C_HEAP_ARRAY(char, _identities, mtCompiler); FREE_C_HEAP_ARRAY(char, _file, mtCompiler); } @@ -268,10 +270,9 @@ } file->print_raw_cr(""); close(partial_fd); - unlink(partial_file); } CompileLog* next_log = log->_next; - delete log; + delete log; // Removes partial file log = next_log; } _first = NULL;