On Wed, 16 Aug 2023 13:36:38 GMT, Matthias Baesken <mbaes...@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 David, > > errno 11 seems to be EAGAIN. > > Sounds like the native code should be retrying in this case. The Java side of this code does have retry logic which will end up reattempting it for a few times (with sleep() in between) https://github.com/openjdk/jdk/blob/master/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java#L939. It's possible that if multiple tests are running and try to acquire this file lock, then they might end up interfering with each other, but it's surprising that in some cases even after multiple attempts the file lock doesn't become available. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15308#issuecomment-1685713819