input-output-hk / iodb

Multiversioned key-value database, especially useful for blockchain
Creative Commons Zero v1.0 Universal
95 stars 13 forks source link

LSMStore get() after close() causes fatal error on the JVM #16

Closed ntallar closed 7 years ago

ntallar commented 7 years ago

I think there might be a problem in the get function from the LSMStore, when trying use get to access the LSMStore after it was closed I get the following error: A fatal error has been detected by the Java Runtime Environment: SIGSEGV. This only seems to happen when previously any update has been done to the LSMStore. I'm using the 0.1.1 version of IODB.

Test that fails

test("LSMStore get after close fails") {
    val TestKeySize = 32
    val testByteArray = (0 until TestKeySize).map(_.toByte).toArray

    val dir: File = File.createTempFile("iodb", "iodb")
    dir.delete()
    dir.mkdir()

    val lSMStore: LSMStore = new LSMStore(dir = dir, keySize = TestKeySize)
    lSMStore.update(ByteArrayWrapper(testByteArray), Seq(), Seq())

    lSMStore.close()
    lSMStore.get(ByteArrayWrapper(testByteArray)) //JVM Crashes
  }