JDK-8263054 : [testbug] SharedArchiveConsistency.java reuses jsa files
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2021-03-05
  • Updated: 2021-03-11
  • Resolved: 2021-03-06
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 17
17 b13Fixed
Related Reports
Relates :  
Description
When running test/hotspot/jtreg/runtime/cds/appcds/SharedArchiveConsistency.java on Windows, sometimes I get this error:

java.io.FileNotFoundException: T:\\testoutput\\test-support\\jtreg_open_test_hotspot_jtreg_hotspot_tier2_runtime\\scratch\\5\\appcds-08h46m47s719.jsa (The requested operation cannot be performed on a file with a user-mapped section open)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(FileOutputStream.java:291)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:234)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184)
	at SharedArchiveConsistency.copyFile(SharedArchiveConsistency.java:294)
	at SharedArchiveConsistency.main(SharedArchiveConsistency.java:462)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:831)



Comments
Changeset: 75a5be8a Author: Ioi Lam <iklam@openjdk.org> Date: 2021-03-06 08:55:42 +0000 URL: https://git.openjdk.java.net/jdk/commit/75a5be8a
06-03-2021

The reason is SharedArchiveConsistency.java runs a child process with a JSA file. Then, it modifies the JSA file, and then tries to reuse this same JSA file to run another child process. However, on Windows, it seems like after first child process has exited, some sort of file lock is still held on the JSA file, so when we try to modify the JSA file for the second process, we get the "The requested operation cannot be performed on a file with a user-mapped section open" error This seems to have been a long standing bug, but it became more reproducible when I am testing my fix for JDK-8263002. So I'll fix it before pushing JDK-8263002. The fix is to always create a new JSA file for every new test case, and never modify/reuse the JSA files. (We have been following this rule for other CDS tests).
05-03-2021