[Date Prev][Date Next]
Re: (ITS#7971) LMDB: Uncarefully appointment when beginning a readonly txn.
On 18/10/14 00:46, email@example.com wrote:
> - ti->mti_readers[i].mr_pid = pid;
> - ti->mti_readers[i].mr_tid = tid;
> + r = &ti->mti_readers[i];
> + r->mr_txnid = (txnid_t)-1;
> + r->mr_tid = tid;
> + r->mr_pid = pid; /* should be written last, see ITS#. */
> if (i == nr)
> ti->mti_numreaders = ++nr;
> /* Save numreaders for un-mutexed mdb_env_close() */
> env->me_numreaders = nr;
Actually that too is too early to set mr_pid: We must be
sure env_close() will reset it. But it is also too late,
we must get rid of any garbage value in md_pid at once
to protect it from other processes' env_close(). Fixing.
Also, I'll rename the confusingly named me_numreaders to
me_close_readers and drop some confused code using it.