On 02/05/2018 18:05, hyc(a)openldap.org wrote:
> Following on from ITS#8505.
> mdb_env_close0() uses env->me_pid when clearing the readers table. If the env
> was open in a process that forked, and the child process calls mdb_env_close(),
> it will be clearing the wrong PID. Change this to use getpid() instead.
Wait, what? The child didn't write any pids to the table. If
there are pids for it to clear, something is wrong. That can be:
- The pid is from an older run, and the system reused the pid. If we
code for this, it should be to clear such pids during mdb_env_open.
It gets very arbitrary to clear them when the user does env_close()
in the child and the child happens to have the that reused pid.
- The child opened a new MDB_env with the same path, and closes the
parent's env afterwards. Don't Do That, users. But what to do in
this situation, if we are to have code for it, is to do nothing with
the lockfile. Not close it either, since closing it will lose the
lock for the env which was opened in the child.