Mercurial push locks

Matt Mackall mpm at selenic.com
Fri Sep 26 17:10:11 UTC 2014


On Fri, 2014-09-26 at 08:23 -0600, durwin at mgtsciences.com wrote:
> Matt Mackall <mpm at selenic.com> wrote on 09/25/2014 02:55:11 PM:
> 
> > From: Matt Mackall <mpm at selenic.com>
> > To: durwin at mgtsciences.com
> > Cc: Simon King <simon at simonking.org.uk>, Mercurial mailing list 
> > <mercurial at selenic.com>
> > Date: 09/25/2014 02:55 PM
> > Subject: Re: Mercurial push locks
> > 
> > On Wed, 2014-09-24 at 13:06 -0600, durwin at mgtsciences.com wrote:
> > > Simon King <simon at simonking.org.uk> wrote on 09/24/2014 12:46:36 PM:
> > > 
> > > > From: Simon King <simon at simonking.org.uk>
> > > > To: durwin at mgtsciences.com
> > > > Cc: Mercurial mailing list <mercurial at selenic.com>
> > > > Date: 09/24/2014 12:46 PM
> > > > Subject: Re: Mercurial push locks
> > > > 
> > > > On 24 Sep 2014, at 16:16, durwin at mgtsciences.com wrote:
> > > > 
> > > > > I have users when push'ing get locked.  If they interrupt the 
> > > > push, it appears to complete.  Also, if I delete the lock file in 
> > > > .hg/store/ it also will complete.  I see no evidence of lost code, 
> > > > it *does* seem to complete.  This occurs when run from command line 
> > > > and from Netbeans.  I have tried to duplicate the issue, but all 
> > > > works for me normally.  I had one user do a clean clone, but the 
> > > > problem still occurs.  I tried duplicating problem as one of the 
> > > > users, but again it all works for me.  I am at a loss.  I included 
> > > > one of the users console output.  Notice where user interrupted 
> process. 
> > > 
> > > > > 
> > > > > project:UsersExample username$ hg commit -m "Added a slider to 
> > > > filter detail. 
> > > > > Also fixed Joe layout" 
> > > > > abort: no username supplied (see "hg help config") 
> > > > > project:UsersExample username$ hg commit -m "Added a slider to 
> > > > filter detail. 
> > > > > Also fixed Joe layout" -u username 
> > > > > project:UsersExample username$ hg push 
> > > > > pushing to ssh://server//home/svnuser/project-hg/WebApplication 
> > > > > searching for changes 
> > > > > remote: listing keys for "bookmarks" 
> > > > > ^Cinterrupted! 
> > > > > remote: adding changesets 
> > > > > remote: changesets: 1 chunks 
> > > > > remote: add changeset 4fde4613957f 
> > > > > remote: adding manifests 
> > > > > remote: manifests: 1/1 chunks (100.00%) 
> > > > > remote: adding file changes 
> > > > > remote: adding UsersExample/web/secure/css/main.css revisions 
> > > > > remote: files: 1/8 chunks (12.50%) 
> > > > > remote: adding UsersExample/web/secure/css/userInfo.css revisions 
> > > > > remote: files: 2/8 chunks (25.00%) 
> > > > > remote: adding UsersExample/web/secure/index.jsp revisions 
> > > > > remote: files: 3/8 chunks (37.50%) 
> > > > > remote: adding UsersExample/web/secure/main.js revisions 
> > > > > remote: files: 4/8 chunks (50.00%) 
> > > > > remote: adding UsersExample/web/secure/microtasks/DetailsTask.js 
> > > revisions 
> > > > > remote: files: 5/8 chunks (62.50%) 
> > > > > remote: adding 
> > > UsersExample/web/secure/summer_api/renderable_alpha/Edge.js 
> > > > > revisions 
> > > > > remote: files: 6/8 chunks (75.00%) 
> > > > > remote: adding UsersExample/web/secure/view/Node.js revisions 
> > > > > remote: files: 7/8 chunks (87.50%) 
> > > > > remote: adding UsersExample/web/secure/view/ValidationEdge.js 
> > > revisions 
> > > > > remote: files: 8/8 chunks (100.00%) 
> > > > > remote: added 1 changesets with 8 changes to 8 files 
> > > > > remote: updating the branch cache 
> > > > > remote: calling hook changegroup.push: hgext.push-ep.push 
> > > > > remote: Killed by signal 2. 
> > > > > 
> > > > 
> > > > What does the remote changegroup.push hook do? Does it complete?
> > > 
> > > It calls a python hook.
> > > 
> > > [hooks]
> > > changegroup.push = python:hgext.push-ep.push
> > > 
> > > This is the code.
> > > 
> > > import logging
> > > import os
> > > import pwd
> > > import syslog
> > > 
> > > def push(ui, repo, node, hooktype, **kwargs):
> > >     call(["sudo", "-u", "svnuser", "/usr/bin/hg-svnuser", "push", 
> "-f", 
> > > "--debug", "-R", "/home/svnuser/project-hg/WebApplication/"])
> > >     syslog.syslog("Mercurial push by " + pwd.getpwuid(os.getuid())[0])
> > >     syslog.syslog(hooktype)
> > >     return False
> > > 
> > > The syslog messages are in the log, and when I do hg 
> incoming/outgoing, it 
> > > indicates both repositories are in sync.
> > > 
> > > One user pushes to repository B, it pushes to A.  Other users push to 
> A 
> > > and it pushes to B.
> > > 
> > > This use to work without the locking.  And as I mentioned, it works 
> for me 
> > > (no locking).
> > 
> > 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?

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list