IO error: No locks available

55 views
Skip to first unread message

tamal adhikary

unread,
Jun 24, 2020, 9:16:00 PM6/24/20
to leveldb
I have a very simple code to create a database. It gives me the following error:

Unable to open/create test database './testdb'
IO error: lock ./testdb/LOCK: No locks available

I deleted the 'testdb' directory, renamed the database, still having the same error. The tester code is attached here.

#include <iostream>
#include <sstream>
#include <string>
#include <cassert>

#include "leveldb/db.h"

using namespace std;

int main(int argcchar** argv)
{
    // Set up database connection information and open database
    leveldb::DB* db;
    leveldb::Options options;
    options.create_if_missing = true;

    leveldb::Status status = leveldb::DB::Open(options, "./testdb", &db);
assert(status.ok());
 
    // Iterate over each item in the database and print them
    leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());
    
    delete it;
    
    delete db;
}

tamal adhikary

unread,
Jun 24, 2020, 9:31:23 PM6/24/20
to leveldb
I inserted the following lines after assert(status.ok()) which produced the output.

if (!status.ok())
    {
        cerr << "Unable to open/create test database './testdb'" << endl;
        cerr << status.ToString() << endl;
        return -1;
    }


Joe Steeve

unread,
Jun 28, 2020, 12:42:25 PM6/28/20
to lev...@googlegroups.com
On Wed, 2020-06-24 at 18:15 -0700, tamal adhikary wrote:
> I have a very simple code to create a database. It gives me the
> following error:
>
> Unable to open/create test database './testdb'
> IO error: lock ./testdb/LOCK: No locks available

What OS are you running it on?

Where is the testdb folder located? Is it a local file-system?

--
Joe Steeve
HiPro IT Solutions Private Limited
http://www.hipro.co.in

signature.asc

tamal adhikary

unread,
Jun 30, 2020, 12:49:20 AM6/30/20
to leveldb
I am running on Ubuntu 16.04. testdb folder is created when the sample code is run in the same directory.
Reply all
Reply to author
Forward
0 new messages