Hi Jon,

I have logged your patch into the issue tracker, 3546;
http://subversion.tigris.org/issues/show_bug.cgi?id=3546

Gavin


On 28/11/2009, at 06:53 , Jon Foster wrote:

> Hi,
> 
> This fixes the race condition where two svnsync processes can lock
> the repository at the same time (as noticed by Stefan Sperling
> earlier today).  I wanted to do this without changing the RA layer,
> so that it can work with older servers.
> 
> Since the RA layer doesn't have a test-and-set primitive (other
> than a commit!), some raciness is inevitable.  This patch fixes the
> dangerous race, but introduces a much less dangerous race.  With
> this patch, two "svnsync" processes trying to lock the repository at
> the same time might both fail to get the lock.  To mitigate this,
> both processes will sleep for a random amount of time before
> retrying.  This should reduce the chance of them staying in lock-step
> and repeatedly failing.  (Hopefully the chance becomes negligible).
> 
> This doesn't conflict with my --use-external-locking patch from
> earlier today; they change different parts of the code and have
> different use-cases.
> 
> [[[
> Fix race condition that allowed two svnsync processes to get the lock
> at the same time.
> 
> * subversion/include/svn_props.h:
>  (SVNSYNC_PROP_PRE_LOCK_PREFIX): New define.
> 
> * subversion/svnsync/main.c:
>  (get_local_host_name, generate_moderately_random_number,
>   try_get_lock): New functions.
>  (get_lock): Rewritten.
> 
> Found by: stsp
>          Jon Foster <jon.fos...@cabot.co.uk>
> (Independently discovered)
> Patch by: Jon Foster <jon.fos...@cabot.co.uk>
> ]]]
> 
> Apologies for the .zip format - my mailserver is blocking outgoing
> .patch files.
> 
> Kind regards,
> 
> Jon Foster
> 
> 
> **********************************************************************
> This email and its attachments may be confidential and are intended solely 
> for the use of the individual to whom it is addressed. Any views or opinions 
> expressed are solely those of the author and do not necessarily represent 
> those of Cabot Communications Ltd.
> 
> If you are not the intended recipient of this email and its attachments, you 
> must take no action based upon them, nor must you copy or show them to anyone.
> 
> Cabot Communications Limited
> Verona House, Filwood Road, Bristol BS16 3RY, UK
> +44 (0) 1179584232
> 
> Co. Registered in England number 02817269
> 
> Please contact the sender if you believe you have received this email in 
> error.
> 
> **********************************************************************
> 
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________<svnsync-two-step-locking.zip>

Reply via email to