Problem afer upgrading to 3.42.0 : Could not lock User prefs

Hello,

Since OSS 3.42.0-01, I now have tons of logs like this

WARN  [Timer-0]  *SYSTEM java.util.prefs - Could not lock User prefs.  Unix error code 2.
WARN  [Timer-0]  *SYSTEM java.util.prefs - Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

Those logs started to appear after migrating from OSS 3.41.0-01, with no changes to directory permissions.
My nexus instance runs with docker, with a host bound volume.
Here is the docker-compose.yml

version: '3.9'
services:   
   nexus:     
    image: sonatype/nexus3:3.42.0
    restart: unless-stopped
    container_name: nexus-repository
    ports:
        - 127.0.0.1:8081:8081
    environment:
        - "INSTALL4J_ADD_VM_PARAMS=-Xms2g -Xmx3g -XX:MaxDirectMemorySize=2g"
    volumes:
           - /docker-nexus-repository:/nexus-data

and here is the content of this directory :

drwxrwxrwx   17 root root   281  5 nov.  11:12 .
dr-xr-xr-x.  24 root root  4096 23 mars   2022 ..
drwxr-xr-x    8  200  200   136 15 mars   2022 blobs
drwxr-xr-x  320  200  200  8192  5 nov.  11:13 cache
drwxr-xr-x    6  200  200   113  5 nov.  08:53 db
drwxr-xr-x    2  200  200    80 26 oct.  18:04 downloads
drwxr-xr-x    3  200  200    36 14 févr.  2022 elasticsearch
drwxr-xr-x    3  200  200    45 13 juin  14:14 etc
drwxr-xr-x    2  200  200     6 14 févr.  2022 generated-bundles
drwxr-xr-x    2  200  200    33 14 févr.  2022 instances
drwxr-xr-x    2  200  200     6 21 févr.  2022 kar
-rw-rw-rw-    1  200  200     1  5 nov.  11:12 karaf.pid
drwxr-xr-x    3  200  200    18 14 févr.  2022 keystores
-rw-rw-rw-    1  200  200    14  5 nov.  11:12 lock
drwxr-xr-x    4  200  200 12288  7 nov.  03:19 log
drwxr-xr-x    2  200  200     6 14 févr.  2022 orient
-rw-rw-rw-    1  200  200     5  5 nov.  11:12 port
drwxr-xr-x    2  200  200     6 25 avril  2022 restore-from-backup
drwxr-xr-x   10  200  200  4096  7 nov.  11:15 tmp
drwxr-xr-x    2  200  200     6  5 nov.  08:53 upgrades

Is there a problem somewhere ?
I know documentation tells I could change the -Djava.util.prefs.userRoot, but as I didn’t change anything but upgrading the version, I think a change in nexus might appeared.
Thank you for helping

We started to have this issue a few days ago, without any upgrade, and were only able to move past it by setting -Djava.util.prefs.userRoot to a directory on the volume docker was mounting. the dir javaprefs seems to be what is used by default.

1 Like

Well, I don’t understand what is happening here.
Does someone know the original value of -Djava.util.prefs.userRoot ? where should it go by default ?

1 Like

Same here. Where do we change that when running the docker image? Looking at Comparing 3.38.1...3.42.0 · sonatype/docker-nexus3 · GitHub -

sonatype/docker-nexus3/commit/8ff3c50 has a lot going on, maybe that caused this?

Well, my problem was that I was overriding INSTALL4J_ADD_VM_PARAMS, without giving value for java.util.prefs.userRoot

TNow the documentations mentions it there https://github.com/sonatype/docker-nexus3/blob/main/README.md#notes:

Defaults to -Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs

So after giving the value for user root prefs, it’s now ok.

2 Likes