Details
-
Bug
-
Resolution: Fixed
-
P4
-
16
-
b10
-
x86_64
-
windows
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8268410 | 16u-cpu | Evan Whelan | P4 | Resolved | Fixed | master |
JDK-8268243 | 16.0.2 | Evan Whelan | P4 | Resolved | Fixed | b07 |
Description
ADDITIONAL SYSTEM INFORMATION :
On every Windows from Java version 8 to 16.
A DESCRIPTION OF THE PROBLEM :
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at java.util.prefs.AbstractPreferences.isUserNode(Unknown Source)
at java.util.prefs.WindowsPreferences.rootNativeHandle(Unknown Source)
at java.util.prefs.WindowsPreferences.<init>(Unknown Source)
at java.util.prefs.WindowsPreferences.getUserRoot(Unknown Source)
at java.util.prefs.WindowsPreferencesFactory.userRoot(Unknown Source)
at java.util.prefs.Preferences.userRoot(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.prefs.AbstractPreferences.isUserNode(Unknown Source)
at java.util.prefs.WindowsPreferences.rootNativeHandle(Unknown Source)
at java.util.prefs.WindowsPreferences.<init>(Unknown Source)
at java.util.prefs.WindowsPreferences.getUserRoot(Unknown Source)
at java.util.prefs.WindowsPreferencesFactory.userRoot(Unknown Source)
at java.util.prefs.Preferences.userRoot(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.prefs.AbstractPreferences.isUserNode(Unknown Source)
at java.util.prefs.WindowsPreferences.rootNativeHandle(Unknown Source)
at java.util.prefs.WindowsPreferences.<init>(Unknown Source)
at java.util.prefs.WindowsPreferences.getUserRoot(Unknown Source)
at java.util.prefs.WindowsPreferencesFactory.userRoot(Unknown Source)
at java.util.prefs.Preferences.userRoot(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
The problem is that the error handler is not using the parameter of the constructor. Else it is calling a function that trigger the constructor again.
private WindowsPreferences(long rootNativeHandle, byte[] rootDirectory) {
super(null, "");
long[] result =
WindowsRegCreateKeyEx1(rootNativeHandle, rootDirectory);
if (result[ERROR_CODE] != ERROR_SUCCESS) {
logger().warning("Could not open/create prefs root node " +
byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Long.toHexString(rootNativeHandle()) +
". Windows RegCreateKeyEx(...) returned error code " +
result[ERROR_CODE] + ".");
isBackingStoreAvailable = false;
return;
}
// Check if a new node
newNode = (result[DISPOSITION] == REG_CREATED_NEW_KEY);
closeKey(result[NATIVE_HANDLE]);
}
In the code rootNativeHandle() should be replaces with rootNativeHandle. Removing the parentheses should solve the StackOverflowError and show the real error.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
calling Preferences.userRoot() if no access rights to the registry
CUSTOMER SUBMITTED WORKAROUND :
Give the user more access right to the user of the Java process.
FREQUENCY : always
On every Windows from Java version 8 to 16.
A DESCRIPTION OF THE PROBLEM :
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at java.util.prefs.AbstractPreferences.isUserNode(Unknown Source)
at java.util.prefs.WindowsPreferences.rootNativeHandle(Unknown Source)
at java.util.prefs.WindowsPreferences.<init>(Unknown Source)
at java.util.prefs.WindowsPreferences.getUserRoot(Unknown Source)
at java.util.prefs.WindowsPreferencesFactory.userRoot(Unknown Source)
at java.util.prefs.Preferences.userRoot(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.prefs.AbstractPreferences.isUserNode(Unknown Source)
at java.util.prefs.WindowsPreferences.rootNativeHandle(Unknown Source)
at java.util.prefs.WindowsPreferences.<init>(Unknown Source)
at java.util.prefs.WindowsPreferences.getUserRoot(Unknown Source)
at java.util.prefs.WindowsPreferencesFactory.userRoot(Unknown Source)
at java.util.prefs.Preferences.userRoot(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.prefs.AbstractPreferences.isUserNode(Unknown Source)
at java.util.prefs.WindowsPreferences.rootNativeHandle(Unknown Source)
at java.util.prefs.WindowsPreferences.<init>(Unknown Source)
at java.util.prefs.WindowsPreferences.getUserRoot(Unknown Source)
at java.util.prefs.WindowsPreferencesFactory.userRoot(Unknown Source)
at java.util.prefs.Preferences.userRoot(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
at java.util.prefs.AbstractPreferences$1.run(Unknown Source)
The problem is that the error handler is not using the parameter of the constructor. Else it is calling a function that trigger the constructor again.
private WindowsPreferences(long rootNativeHandle, byte[] rootDirectory) {
super(null, "");
long[] result =
WindowsRegCreateKeyEx1(rootNativeHandle, rootDirectory);
if (result[ERROR_CODE] != ERROR_SUCCESS) {
logger().warning("Could not open/create prefs root node " +
byteArrayToString(windowsAbsolutePath()) +
" at root 0x" + Long.toHexString(rootNativeHandle()) +
". Windows RegCreateKeyEx(...) returned error code " +
result[ERROR_CODE] + ".");
isBackingStoreAvailable = false;
return;
}
// Check if a new node
newNode = (result[DISPOSITION] == REG_CREATED_NEW_KEY);
closeKey(result[NATIVE_HANDLE]);
}
In the code rootNativeHandle() should be replaces with rootNativeHandle. Removing the parentheses should solve the StackOverflowError and show the real error.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
calling Preferences.userRoot() if no access rights to the registry
CUSTOMER SUBMITTED WORKAROUND :
Give the user more access right to the user of the Java process.
FREQUENCY : always
Attachments
Issue Links
- backported by
-
JDK-8268243 StackOverflowError on open WindowsPreferences
- Resolved
-
JDK-8268410 StackOverflowError on open WindowsPreferences
- Resolved
- links to
-
Commit openjdk/jdk16u/53dd617e
-
Commit openjdk/jdk/849390a1
-
Review openjdk/jdk16u/78
-
Review openjdk/jdk/2326
(1 links to)