[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8505) LMDB vs. fork()



I wrote:
>On 29. sep. 2016 18:27, lmb@cloudflare.com wrote:
>> If I understand you correctly, LMDB would be safe to use in these
>> scenarios in an ideal world:
>>
>> 1. mdb_env_open(), fork(), exec() (without fd leaks I'd argue)
>> 2. mdb_env_open(), pthread_create(), fork()
>> 3. mdb_env_open(), fork()
>>
>> As far as I understand you are after 2 and 3, while I want 1.
>
> I'm after all three.

...if the user calls the cleanup function.  But:

Whoops, correction: If you mean using LMDB after fork(), (2)
can't be safe unless the user makes it safe with pthread_atfork().
But at least it can clean up some of the stuff (3) also does,
and he'll have the pthread_atfork option if he really needs it.