RocksDB: Unhandled exception thrown: read access violation


I have simple rocksdb program where I create a DB and put some values in it using transactions.

using namespace rocksdb;

std::string kDBPath = "D:\\Newdata";
int main() {
    // open DB
    Options options;
    TransactionDBOptions txn_db_options;
    options.create_if_missing = true;
    TransactionDB* txn_db;

    Status s = TransactionDB::Open(options, txn_db_options, kDBPath, &txn_db);

    WriteOptions write_options;
    ReadOptions read_options;
    TransactionOptions txn_options;
    std::string value;

    // Simple Transaction Example ("Read Committed")

    // Start a transaction
    Transaction* txn = txn_db->BeginTransaction(write_options);

    // Read a key in this transaction
    //s = txn->Get(read_options, "abc", &value);

    // Write a key in this transaction
    s = txn->Put("abc", "def");

    // Read a key OUTSIDE this transaction. Does not affect txn.
    s = txn_db->Get(read_options, "abc", &value);

    // Write a key OUTSIDE of this transaction.
    // Does not affect txn since this is an unrelated key.
    s = txn_db->Put(write_options, "xyz", "zzz");

    // Write a key OUTSIDE of this transaction.
    // Fail because the key conflicts with the key written in txn.
    s = txn_db->Put(write_options, "abc", "def");
    assert(s.subcode() == Status::kLockTimeout);

    // Value for key "xyz" has been committed, can be read in txn.
    s = txn->Get(read_options, "xyz", &value);
    assert(value == "zzz");

    // Commit transaction
    s = txn->Commit();
    std::cout << "End program";
    return 0;

It is failing at first Put. Error:

Exception thrown at 0x00007FF7FCAD0D84 in Rocksdbtest.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Unhandled exception thrown: read access violation.
txn->**** was 0xFFFFFFFFFFFFFF27.

Debugging using VS shows <Unable to read memory> for name field of txn. Same program was running fine before VS update.

asked on Stack Overflow Jun 16, 2020 by Kushal Warke • edited Jun 17, 2020 by Kushal Warke

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0