Race condition in tdb_runtime_check_for_robust_mutexes()
slow at samba.org
Thu Mar 24 14:57:31 UTC 2016
On Thu, Mar 24, 2016 at 03:44:09PM +0200, Uri Simchoni wrote:
> On 03/23/2016 08:45 PM, Ralph Boehme wrote:
> > haven't looked at your patch closely yet, just wanted to mention a
> > possible way to avoid the spurious SIGCHLD signal problem when we
> > block it.
> > Instead we can keep the handler, but dont set SA_RESTART when
> > installing it (this ensures sleep() will be interrupted later), remove
> > waitpid from the handler, just set a flag.
> > Then in the rendesvous part a) check flag, if not set b) sleep(), if
> > set done. The sleep will be either interrupted or awake, goto a).
> It seems to me that this algorithm doesn't exactly capture the current
> behavior, because while we sleep, the handler calls the previously
> installed handler,
sorry if that wasn't clear, I meant to say "keep the semantics of
installing our own handler".
Something like the attached patch. This can probably be enhanced by
using pselect with a timeout and a signal mask to block/unblock
SIGCHLD instead of sleep.
> and that one could reap our child process. If we
> don't call the other handler, then we cause it to miss some signals.
> Do you have issues with the current patch which retains the current
> behavior of "playing nicely with the environment" and only removes
> (hopefully) the race condition?
not really, was just trying to think of a better approach to avoid the
potential spurious SIGCHLD signal for the library user.
More information about the samba-technical