Ok. Just figured out it was due to PTHREAD_KEYS_MAX. using MDB_NOTLS removes the dependency.

Jeremy
On Tuesday, September 11, 2018, 10:15:39 PM PDT, Jeremy Chen <jchen200@yahoo.com> wrote:


Hi

I have been using lmdb (with java binding on Ubuntu 14.04+, or Centos 7) to manage daily data sets for a while and so far it works beautifully.  Now I am trying to add multi-tenancy support with physical partitioning, but fails to create more than 1024 environments (1017 to be exact).  The error msg is "Resource temporarily unavailable" (not sure if it's accurate since it's from the lmdbjni binding), and it will only generate a lock.mdb of 0 length in the failed environment.

I tuned a few parameters, like reducing the map size to a few MB each, etc, but to no avail.   

Is this a hard limit? Or I could change something in lmdb source code to extend it? 

Thank you very much!

Jeremy