Mercurial push locks
Simon King
simon at simonking.org.uk
Sat Sep 27 21:14:15 UTC 2014
On 27 Sep 2014, at 00:16, durwin at mgtsciences.com wrote:
> Matt Mackall <mpm at selenic.com> wrote on 09/26/2014 03:30:00 PM:
>
> > From: Matt Mackall <mpm at selenic.com>
> > To: durwin at mgtsciences.com,
> > Cc: Mercurial mailing list <mercurial at selenic.com>, Simon King
> > <simon at simonking.org.uk>
> > Date: 09/26/2014 03:30 PM
> > Subject: Re: Mercurial push locks
> >
> > On Fri, 2014-09-26 at 11:19 -0600, durwin at mgtsciences.com wrote:
> > > > > > With the introduction of phases (Mercurial 2.1, Feb 2012), pushes
> > > may
> > > > > > now acquire a lock on the sending side (so that it can update the
> > > phase
> > > > > > of local commits). Thus, you may get a deadlock if you push inside a
> > > > > > hook where a lock is already held.
> > > > >
> > > > > This appears to what is occurring. Is there a way around this? I
> > > need to
> > > > > perform a push
> > > > > to the other repository after each push to either. Should I change
> > > this
> > > > > to a script and
> > > > > run it in an 'at' job delayed a minute?
> > > >
> > > > What version of Mercurial are you running on the server?
> > >
> > > Mercurial version 2.6.3
> >
> > Hmmm, shouldn't be a problem here: the changegroup hook is run
> > immediately after lock release.
> >
> > Perhaps you can create a minimal model of your flow:
> >
> > $ hg init local
> > $ hg init server1
> > # add push hook
> > $ hg init server2
> >
> > ..and see if you can get it to lock.
>
> I do have a 'test' repository where all I have are two files. The hook always works for me. In fact the project repository all ways works for me. There was a time where I would see the lock, but that is no longer occurring. I tried logging into server as one of the users having the problem and cloned their repository, but it would not lock up, it pushed just fine.
>
I’m not sure I understand your setup here. Based on your earlier emails you say you have:
Local machine
-> push to ssh://server//home/svnuser/project-hg/WebApplication
-> changegroup hook pushing to /home/svnuser/project-hg/WebApplication/
This doesn’t appear to make any sense (changegroup hook pushing to the current repository), so perhaps you’ve changed the paths and they’re not really like this.
For the first push, I assume that each user has their own account on the server, but file permissions are set up such that they all have write privileges on the first server-side repo. This is a potential source of problems if the users don’t have appropriate umask and group settings, as one user could create files that can’t be updated by other users.
The hook then uses sudo to run the second push as the user “svnuser”, and it calls a program called “hg-svnuser”. This raises a couple more questions:
1. Do all users have the same sudo privileges? Perhaps the blocking happens because sudo is trying to prompt for a password in some cases?
2. Is “hg-svnuser” a different installation of mercurial than the one invoked as part of the “initial” push? If so, have you checked the version numbers of both installations?
I don’t know what you mean when you say you logged into the server as a different user and cloned their repository - perhaps you could explain those steps in detail.
Thanks,
Simon
More information about the Mercurial
mailing list