Search code examples
configorientdb

isAuthorized() Exception: Can not close file with id 0 because it is still in use


I upgraded Orientdb from 2.0.16 to 2.2.4.

In 2.0.16 all is fine(databases run and login in browser is working). But now not in 2.2.4. There I get this one in the log:

2016-07-10 20:59:41:942 WARNI {db=OSystem} MBean with name com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations:id=1899654914,name="OSystem",type=OAtomicOperationsMangerMXBean has already registered. Probably your system was not shutdown correctly or you have several running applications which use OrientDB engine inside [OAtomicOperationsManager] 2016-07-10 20:59:41:944 SEVER isAuthorized() Exception: Can not close file with id 0 because it is still in use DB name="OSystem" [OSystemUserAuthenticator]

So I tried to run it locally on my Windows machine. I just downloaded the whole folder and then startet server.bat. And it works without any error.

So why on an Ubuntu it throws that error? And why it works with the same folder on a Windows machine? I did not change anything except the memory settings, that need to be lower on the Ubuntu machine.

When I try to start server.sh today...

I get this one:

 sh /home/ubuntu/orientdb/bin/server.sh
           .
          .`        `
          ,      `:.
         `,`    ,:`
         .,.   :,,
         .,,  ,,,
    .    .,.:::::  ````                                 :::::::::     :::::::::
    ,`   .::,,,,::.,,,,,,`;;                      .:    ::::::::::    :::    :::
    `,.  ::,,,,,,,:.,,.`  `                       .:    :::      :::  :::     :::
     ,,:,:,,,,,,,,::.   `        `         ``     .:    :::      :::  :::     :::
      ,,:.,,,,,,,,,: `::, ,,   ::,::`   : :,::`  ::::   :::      :::  :::    :::
       ,:,,,,,,,,,,::,:   ,,  :.    :   ::    :   .:    :::      :::  :::::::
        :,,,,,,,,,,:,::   ,,  :      :  :     :   .:    :::      :::  :::::::::
  `     :,,,,,,,,,,:,::,  ,, .::::::::  :     :   .:    :::      :::  :::     :::
  `,...,,:,,,,,,,,,: .:,. ,, ,,         :     :   .:    :::      :::  :::     :::
    .,,,,::,,,,,,,:  `: , ,,  :     `   :     :   .:    :::      :::  :::     :::
      ...,::,,,,::.. `:  .,,  :,    :   :     :   .:    :::::::::::   :::     :::
           ,::::,,,. `:   ,,   :::::    :     :   .:    :::::::::     ::::::::::
           ,,:` `,,.
          ,,,    .,`
         ,,.     `,                                          GRAPH DATABASE
       ``        `.
                 ``                                          orientdb.com
                 `
removing old pid file /home/ubuntu/orientdb/bin/orient.pid

2016-07-13 21:06:28:451 INFO  Loading configuration from: /home/ubuntu/orientdb/config/orientdb-server-config.xml... [OServerConfigurationLoaderXml]
2016-07-13 21:06:29:355 INFO  OrientDB Server v2.2.4 (build 2.2.x@rf5282664db9300ef3358fb4d7e2066ad418c2e61; 2016-07-08 12:30:59+0000) is starting up... [OServer]
2016-07-13 21:06:29:372 INFO  Databases directory: /home/ubuntu/orientdb/databases [OServer]Error during initialization of engine 'plocal', engine will be removed
java.lang.reflect.InaccessibleObjectException: Unable to make member of class com.sun.management.internal.OperatingSystemImpl accessible:  module jdk.management does not export com.sun.management.internal to unnamed module @41e68d87
        at sun.reflect.Reflection.throwInaccessibleObjectException(java.base@9-internal/Reflection.java:420)
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(java.base@9-internal/AccessibleObject.java:174)
        at java.lang.reflect.Method.checkCanSetAccessible(java.base@9-internal/Method.java:189)
        at java.lang.reflect.Method.setAccessible(java.base@9-internal/Method.java:183)
        at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaultDiskCacheSize(OMemoryAndLocalPaginatedEnginesInitializer.java:80)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaults(OMemoryAndLocalPaginatedEnginesInitializer.java:63)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:52)
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.startup(OEngineLocalPaginated.java:56)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:872)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Error during engine shutdown
java.lang.NullPointerException
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.shutdown(OEngineLocalPaginated.java:112)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:878)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database 'plocal:/home/ubuntu/orientdb/databases/OSystem'
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'plocal' was unable to start. URL was: plocal:/home/ubuntu/orientdb/databases/OSystem. Registered engines was: [memory, remote, plocal]
        DB name="plocal:/home/ubuntu/orientdb/databases/OSystem"
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:481)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        ... 6 more

So there should not be another Java process... and this never happenend to me in the old version. And what is the OSystem good for? I don't know why it is created. Maybe this is the reason for my issue?

I'm now not even able to start the server. I always get the same message. When I run shutdown.sh I get pid file detected, killing process. I'm out of ideas except downgrading =/

...and sometimes I get...

 sh /home/ubuntu/orientdb/bin/server.sh
           .
          .`        `
          ,      `:.
         `,`    ,:`
         .,.   :,,
         .,,  ,,,
    .    .,.:::::  ````                                 :::::::::     :::::::::
    ,`   .::,,,,::.,,,,,,`;;                      .:    ::::::::::    :::    :::
    `,.  ::,,,,,,,:.,,.`  `                       .:    :::      :::  :::     :::
     ,,:,:,,,,,,,,::.   `        `         ``     .:    :::      :::  :::     :::
      ,,:.,,,,,,,,,: `::, ,,   ::,::`   : :,::`  ::::   :::      :::  :::    :::
       ,:,,,,,,,,,,::,:   ,,  :.    :   ::    :   .:    :::      :::  :::::::
        :,,,,,,,,,,:,::   ,,  :      :  :     :   .:    :::      :::  :::::::::
  `     :,,,,,,,,,,:,::,  ,, .::::::::  :     :   .:    :::      :::  :::     :::
  `,...,,:,,,,,,,,,: .:,. ,, ,,         :     :   .:    :::      :::  :::     :::
    .,,,,::,,,,,,,:  `: , ,,  :     `   :     :   .:    :::      :::  :::     :::
      ...,::,,,,::.. `:  .,,  :,    :   :     :   .:    :::::::::::   :::     :::
           ,::::,,,. `:   ,,   :::::    :     :   .:    :::::::::     ::::::::::
           ,,:` `,,.
          ,,,    .,`
         ,,.     `,                                          GRAPH DATABASE
       ``        `.
                 ``                                          orientdb.com
                 `

2016-07-13 21:14:57:687 INFO  Loading configuration from: /home/ubuntu/orientdb/config/orientdb-server-config.xml... [OServerConfigurationLoaderXml]
2016-07-13 21:14:58:821 INFO  OrientDB Server v2.2.4 (build 2.2.x@rf5282664db9300ef3358fb4d7e2066ad418c2e61; 2016-07-08 12:30:59+0000) is starting up... [OServer]
2016-07-13 21:14:58:858 INFO  Databases directory: /home/ubuntu/orientdb/databases [OServer]Error during initialization of engine 'plocal', engine will be removed
java.lang.reflect.InaccessibleObjectException: Unable to make member of class com.sun.management.internal.OperatingSystemImpl accessible:  module jdk.management does not export com.sun.management.internal to unnamed module @41e68d87
        at sun.reflect.Reflection.throwInaccessibleObjectException(java.base@9-internal/Reflection.java:420)
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(java.base@9-internal/AccessibleObject.java:174)
        at java.lang.reflect.Method.checkCanSetAccessible(java.base@9-internal/Method.java:189)
        at java.lang.reflect.Method.setAccessible(java.base@9-internal/Method.java:183)
        at com.orientechnologies.common.util.OMemory.getPhysicalMemorySize(OMemory.java:65)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaultDiskCacheSize(OMemoryAndLocalPaginatedEnginesInitializer.java:80)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.configureDefaults(OMemoryAndLocalPaginatedEnginesInitializer.java:63)
        at com.orientechnologies.orient.core.engine.OMemoryAndLocalPaginatedEnginesInitializer.initialize(OMemoryAndLocalPaginatedEnginesInitializer.java:52)
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.startup(OEngineLocalPaginated.java:56)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:872)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Error during engine shutdown
java.lang.NullPointerException
        at com.orientechnologies.orient.core.engine.local.OEngineLocalPaginated.shutdown(OEngineLocalPaginated.java:112)
        at com.orientechnologies.orient.core.Orient.startEngine(Orient.java:878)
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:480)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Exception in thread "main" com.orientechnologies.orient.core.exception.ODatabaseException: Error on opening database 'plocal:/home/ubuntu/orientdb/databases/OSystem'
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:187)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:148)
        at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:151)
        at com.orientechnologies.orient.server.OSystemDatabase.<init>(OSystemDatabase.java:44)
        at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1227)
        at com.orientechnologies.orient.server.OServer.activate(OServer.java:342)
        at com.orientechnologies.orient.server.OServerMain.main(OServerMain.java:41)
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'plocal' was unable to start. URL was: plocal:/home/ubuntu/orientdb/databases/OSystem. Registered engines was: [memory, remote, plocal]
        DB name="plocal:/home/ubuntu/orientdb/databases/OSystem"
        at com.orientechnologies.orient.core.Orient.loadStorage(Orient.java:481)
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.<init>(ODatabaseDocumentTx.java:167)
        ... 6 more

Now I tried to downgrade JDK9 to JDK8

It downgraded to JDK 8...

root:~# sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      auto mode
  1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  2            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
root:~# java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
root:~# javac -version
javac 9-internal

but still the same errors...

2016-07-15 14:53:48:347 WARNI {db=OSystem} MBean with name com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations:id=954836302,name="OSystem",type=OAtomicOperationsMangerMXBean has already registered. Probably your system was not shutdown correctly or you have several running applications which use OrientDB engine inside [OAtomicOperationsManager]
2016-07-15 14:53:48:359 SEVER isAuthorized() Exception: Can not close file with id 0 because it is still in use
        DB name="OSystem" [OSystemUserAuthenticator]

Maybe my JAVA_HOME is wrong?

# echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
# sudo update-alternatives --config java
update-alternatives: warning: alternative /usr/lib/jvm/java-9-openjdk-amd64/bin/java (part of link group java) doesn't exist; removing from list of alternatives
There is 1 choice for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode
* 1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:

Solution

  • I got help from here. So the solution is pretty simple. Just set some settings in the server.sh:

    if [ -z "$ORIENTDB_OPTS_MEMORY" ] ; then
        ORIENTDB_OPTS_MEMORY="-Xms64m -Xmx128m"
    fi
    
    if [ -z "$JAVA_OPTS_SCRIPT" ] ; then
        JAVA_OPTS_SCRIPT="-Djna.nosys=true -XX:+HeapDumpOnOutOfMemoryError -XX:MaxDirectMemorySize=200g -Djava.awt.headless=true -Dfile.encoding=UTF8 -Drhino.opt.level=9"
    fi
    
    # ORIENTDB SETTINGS LIKE DISKCACHE, ETC
    if [ -z "$ORIENTDB_SETTINGS" ]; then
        ORIENTDB_SETTINGS="-Dstorage.diskCache.bufferSize=128 -Dmemory.chunk.size=33554432"
    fi