[13] RFR(S): 8223885: hs_err and replay file may contain garbage when overwriting existing file

Tobias Hartmann tobias.hartmann at oracle.com
Thu May 16 06:54:01 UTC 2019


Hi David,

On 16.05.19 04:21, David Holmes wrote:
> Thinking more on this problem I think we need to back out JDK-8221738 and redo it so that it only
> affects the error file. It was never discussed that it would also impact the replay file, and such a
> change was not part of the CSR. I will file a bug for that.

Okay, that's reasonable.

> But I'm also a bit perplexed about the current bug and how it arose. The issue is that we overwrote
> an existing replay file with a shorter version and so got garbage at the end. When that file was
> read back the garbage caused the problem. But how did we come to write a replay file that already
> existed? Was this not named in a process-unique way?

No, the test triggers multiple JVM crashes and sets the same replay file name for all of them via
the -XX:ReplayDataFile command line option:
http://hg.openjdk.java.net/jdk/jdk/file/eedc3db527ac/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java#l48

Although the file is deleted after each run/crash, the operating system might not yet have removed
it from the disk (even when enabling the waitForCondition() on all platforms):
http://hg.openjdk.java.net/jdk/jdk/file/eedc3db527ac/test/hotspot/jtreg/compiler/ciReplay/CiReplayBase.java#l115

As a result, we overwrite parts of the file when the next VM instance crashes (calling Thread.sleep
fixes the issue).

> Further, before the change by JDK-8221738 the
> fact the file existed meant we would have written it to a different location - in which case how
> would the code that ends up reading the file know to get it from the other location given it would
> have found the old file in the original location?

Yes, that worked by accident. In this case, the test was just happily reading the old file. So if we
go back to not overwriting existing replay files, we need to fix the test. There are other known
problems with these replay tests (see JDK-8029528).

Best regards,
Tobias


More information about the hotspot-dev mailing list