-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Hello,
(first of all, thanks for this library!)
I've been struggling with trying to use many concurrent workers reading from a database using this library. lmdb has a default parameter of 126 max_readers. Indeed, when I tried to use 128 concurrent workers, I got the expected error
mdb_txn_begin: MDB_READERS_FULL: Environment maxreaders limit reached
I saw that lmdbm doesn't expose the max_readers parameter, so I tried subclassing the Lmdb class to expose it in the open classmethod; however, when trying to set it to more than 126 and use more than 126 concurrent workers, I get the error:
mdb_txn_begin: Invalid argument
Remark that it's really an "and": if I set max_readers to whatever value > 126, but only use 126 concurrent workers or fewer, the error doesn't appear. So for practical purposes, setting max_readers flag to be > 126 is only changing the error I'm getting (and minor things like the lock.mdb file size), but not the practical results.
(to be double sure I didn't mess up with subclassing, I even tried hard-coding in the lmdbm code the line:
env = lmdb.open(file, map_size=map_size, max_dbs=1, readonly=True, create=False, mode=mode, max_readers=256)
but I got the exact same error)
Am I missing something in lmdb(m) implementation, or is there a bug somewhere? I wasn't able to track down where this error is coming from exactly...