-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P3
-
Affects Version/s: 25, 26
-
Component/s: hotspot
-
b25
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
|---|---|---|---|---|---|---|
| JDK-8372825 | 25.0.3-oracle | Joakim Nordström | P3 | Resolved | Fixed | b01 |
| JDK-8374118 | 25.0.3 | Aleksey Shipilev | P3 | Resolved | Fixed | master |
During the AOT training run, some application may close System.out (usually by naive code like the following):
try (var err = new PrintWriter(System.err);
var out = new PrintWriter(System.out)) {
out.println("Hello Confused World");
}
This has the side effect of closing the JVM's STDOUT.
When the JVM is about to exit, we will open the AOT configuration file for writing. On Windows we may get back a file HANDLE (which is just an integer) that's identical to the now closed STDOUT.
If the JVM writes to STDOUT (usually with UL logging), it will corrupt the contents of the AOT configuration file.
This doesn't happen on Posix as System.out.close() will keep file descriptions 1 and 2 open, preventing them to be reused by files that are opened in the future.
=============
The fix is to open the AOT configuration file early, before any application code is executed. That way we can guarantee that we will have a file HANDLE (or file descriptor) that's different than STDOUT.
try (var err = new PrintWriter(System.err);
var out = new PrintWriter(System.out)) {
out.println("Hello Confused World");
}
This has the side effect of closing the JVM's STDOUT.
When the JVM is about to exit, we will open the AOT configuration file for writing. On Windows we may get back a file HANDLE (which is just an integer) that's identical to the now closed STDOUT.
If the JVM writes to STDOUT (usually with UL logging), it will corrupt the contents of the AOT configuration file.
This doesn't happen on Posix as System.out.close() will keep file descriptions 1 and 2 open, preventing them to be reused by files that are opened in the future.
=============
The fix is to open the AOT configuration file early, before any application code is executed. That way we can guarantee that we will have a file HANDLE (or file descriptor) that's different than STDOUT.
- backported by
-
JDK-8372825 AOT configuration is corrupted when app closes System.out
-
- Resolved
-
-
JDK-8374118 AOT configuration is corrupted when app closes System.out
-
- Resolved
-
- links to
-
Commit(master)
openjdk/jdk25u-dev/f18b1ace
-
Commit(master)
openjdk/jdk/1535d08f
-
Review(master)
openjdk/jdk25u-dev/93
-
Review(master)
openjdk/jdk/28335
(1 links to)