[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1727621 - in /subversion/trunk/subversion: svn/svn.c svnadmin/svnadmin.c svnbench/svnbench.c svnfsfs/svnfsfs.c svnlook/svnlook.c svnrdump/svnrdump.c svnsync/svnsync.c

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Mon, 08 Feb 2016 10:33:05 +0000

Daniel Shahaf <d.s_at_daniel.shahaf.name> writes:

> I think we have two options to fix this: either make signum_cancelled
> a write-once variable (never write to it if it's nonzero), or have the
> handler install SIG_IGN handlers for all signals we catch, not just for
> one of them. Or perhaps both? The former approach seems more robust
> but the latter seems like a good idea in its own right.

There is a race right at the end but there is also a race with a much
bigger window earlier. When a signal, say SIGINT, causes the program to
begin the process of cancelling then a second signal, say SIGTERM, can
arrive before we get to the exit code.

When there are two different signals I don't think there is a 'correct'
signal with which to exit, all that matters is that we exit with one of
the signals. So how about:

      int saved_signum = signum_cancelled;
      apr_signal(saved_signum, SIG_DFL);
      kill(getpid(), saved_signum);

-- 
Philip Martin
WANdisco
Received on 2016-02-08 11:33:12 CET

This is an archived mail posted to the Subversion Dev mailing list.