RFR: JDK-8314272: Improve java.util.prefs.BackingStoreException: Couldn't get file lock.

Jaikiran Pai jpai at openjdk.org
Fri Aug 18 12:17:27 UTC 2023


On Wed, 16 Aug 2023 13:36:38 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> We run into some BackingStoreException: Couldn't get file lock. e.g. here :
> 
> [JShell] Exception in thread "main" java.lang.IllegalStateException: java.util.prefs.BackingStoreException: Couldn't get file lock.
> [JShell] at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder$PreferencesStorage.flush(JShellToolBuilder.java:313)
> [JShell] at jdk.jshell/jdk.internal.jshell.tool.JShellTool$ReplayableHistory.storeHistory(JShellTool.java:692)
> [JShell] at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:1008)
> [JShell] at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:261)
> [JShell] at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120)
> [JShell] Caused by: java.util.prefs.BackingStoreException: Couldn't get file lock.
> [JShell] at java.prefs/java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:769)
> [JShell] at java.prefs/java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:864)
> [JShell] at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder$PreferencesStorage.flush(JShellToolBuilder.java:311)
> [JShell] ... 4 more
> 
> The BackingStoreException should be enhanced e.g. by adding the errno/errorCode that is already available in the coding

Hello Matthias, I think adding some diagnostics in this class would be a good thing. Like in the JBS issue that this PR links to, there's another JBS issue https://bugs.openjdk.org/browse/JDK-8304938 where we run into intermittent failures because of this exception.

However, before doing the changes being proposed in this PR, would it be better to do those (minimal) changes in a private build and run those tests and see if these proposed error number or error message diagnostics do provide the needed detail to narrow down this issue? That might provide insight on what else (if anything) would need to be included in that diagnostic message.

In the meantime, I'll run your proposed change which shows the error number, just to see if that tells us what's going on with these tests, when they fail.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15308#issuecomment-1683831684


More information about the core-libs-dev mailing list