JDK-8221738 : ErrorFile option does not handle pre-existing error files of the same name
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-04-01
  • Updated: 2019-08-15
  • Resolved: 2019-05-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b21Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8223231 :  
Description
Specifying -XX:ErrorFile=<path> only succeeds if there is not already a file at <path>. When there is, it will silently revert to the default path/filename which is hs_err... in the current directory:

java -XX:ErrorHandlerTest=13 -XX:ErrorFile=/tmp/hallo
#
# A fatal error has been detected by the Java Runtime Environment:
..
#
# An error report file with more information is saved as:
# /tmp/hallo

java -XX:ErrorHandlerTest=13 -XX:ErrorFile=/tmp/hallo
#
# A fatal error has been detected by the Java Runtime Environment:
#
...
#
# An error report file with more information is saved as:
# /shared/projects/openjdk/test/hs_err_pid14685.log
#

That is not useful.

More useful alternatives would be:
- append or overwrite the existing file
- create a new file with an appendix ("_<num>" or "_pid")

Comments
I agree. Was confused too. Lets redo this.
16-05-2019

I did not realize that this change would affect anything but the "ErrorFile"! The changes to the replay file was never considered or discussed. I think this change should be re-done so that it only affects the error file as that is all that was approved to be changed by the CSR. I filed JDK-8224023 for this.
16-05-2019

This change broke replay compilation because the hs_err and replay file may now contain garbage when overwriting an existing file (see JDK-8223885).
15-05-2019

Also see JDK-8189672
02-04-2019

Hi David, see my extended explanation - especially the reasoning why I find the current behavior bad - in the associated CSR.
02-04-2019

The only issue I see here is the "silently ignored" part. I have no issue with a specified behaviour that says "if the file exists it is ignored and the default used". People are generally expected to define "unique" names using %p
01-04-2019