--- old/src/hotspot/share/utilities/vmError.cpp 2019-01-14 16:42:04.898765061 +0100 +++ new/src/hotspot/share/utilities/vmError.cpp 2019-01-14 16:42:04.702765889 +0100 @@ -1299,7 +1299,7 @@ // File descriptor to tty to print an error summary to. // Hard wired to stdout; see JDK-8215004 (compatibility concerns). - static const int fd_out = 1; + static const int fd_out = 1; // stdout // File descriptor to the error log file. static int fd_log = -1; @@ -1310,7 +1310,8 @@ fdStream out(fd_out); out.set_scratch_buffer(buffer, sizeof(buffer)); - fdStream log(fd_log); // May or may not be open at this point. + // Depending on the re-entrance depth at this point, fd_log may be -1 or point to an open hs-err file. + fdStream log(fd_log); log.set_scratch_buffer(buffer, sizeof(buffer)); // How many errors occurred in error handler when reporting first_error. @@ -1473,11 +1474,11 @@ _current_step = 0; _current_step_info = ""; - if (fd_log != fd_out) { + if (fd_log != -1) { close(fd_log); + fd_log = -1; } - fd_log = -1; log.set_fd(-1); }