facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
27.85k stars 6.2k forks source link

Cannot start RocksDB XTDB nodes from multiple processes on Windows #12780

Closed serioga closed 2 weeks ago

serioga commented 2 weeks ago

Expected behavior

Work on Windows simultaneously with multiple apps that use XTDB connection with RocksDB.

Actual behavior

Only first running instance can start XTDB node. Other apps produce error:

Execution error at org.rocksdb.NativeLibraryLoader/loadLibraryFromJarToTemp (NativeLibraryLoader.java:142).
File: C:\Users\ST\AppData\Local\Temp\xtdb_rocksdb-6.12.7\librocksdbjni-win64.dll already exists and cannot be removed.

Steps to reproduce the behavior

Start XTDB node with RocksDB storage from different processes simultaneously.

adamretter commented 2 weeks ago

@serioga I think we need to eliminate any XTDB issues here really.

In your error above I see the number 6.12.7 but it also references line 142 of NativeLibraryLoader.java, however there is no such line in RocksDB 6.12.7, see: https://github.com/facebook/rocksdb/blob/v6.12.7/java/src/main/java/org/rocksdb/NativeLibraryLoader.java

What version of RocksDB are you using please?

serioga commented 2 weeks ago

What version of RocksDB are you using please?

com.xtdb/xtdb-rocksdb     {:mvn/version "1.24.3"}

which uses org.rocksdb/rocksdbjni:7.7.3 with lines in org.rocksdb.NativeLibraryLoader:

        if (temp.exists() && !temp.delete()) {
          throw new RuntimeException(
              "File: " + temp.getAbsolutePath() + " already exists and cannot be removed.");
        }

I have no idea where the xtdb_rocksdb-6.12.7 in the path comes from.

jarohen commented 2 weeks ago

@serioga, @adamretter thanks for looking into this :pray:

I believe we should be able to pass null to loadLibrary and get Rocks to manage the temp-dir for us - I'll investigate that and get back to you.

(xtdb/xtdb#3113 on our side)

serioga commented 2 weeks ago

I have no idea where the xtdb_rocksdb-6.12.7 in the path comes from.

Ah, this is from the xtdb.rocksdb.loader:

(defn- load-rocksdb-native-lib []
  (let [tmp (doto (io/file (System/getProperty "java.io.tmpdir") "xtdb_rocksdb-6.12.7") .mkdirs)
        library (io/file tmp (Environment/getJniLibraryFileName "rocksdb"))]
    (.loadLibrary (NativeLibraryLoader/getInstance) (str tmp))
    (str library)))
refset commented 2 weeks ago

With today's minor release of XTDB 1.24.4 this issue can now be closed - thanks again for the report @serioga and apologies for the noise here :slightly_smiling_face: