HgWeb.cgi Hanging During Push

Jensen, Aaron ajensen at webmd.net
Fri Apr 27 19:01:30 UTC 2012


> Ok, how about you instrument lock.release() and see where it's blocking.

See below for my instrumentation changes [1] and the sequence of calls by push #1 (which succeeds) and push #2 (which hangs) [2].

It looks like unbundle is *not* hanging.  I didn’t notice before, but unbundle is returning with an unsynced changes error.  I think the hang is happening somewhere else in the code.  

It looks like after unbundle, lock.release() gets called one more time.  Where in the code should I go next?

     <:> Aaron


[1] Here are my instrumentation log messages:

wireproto.py:

    try:
        proto.getfile(fp)
        sys.stderr.write("%d: at step 1\n" % os.getpid()); sys.stderr.flush()
        lock = repo.lock()
        sys.stderr.write("%d: at step 2\n" % os.getpid()); sys.stderr.flush()
        try:
            if not check_heads():
                sys.stderr.write("%d: at step 3\n" % os.getpid()); sys.stderr.flush()
                # someone else committed/pushed/unbundled while we
                # were transferring data
                return pusherr('unsynced changes')

            # push can proceed
            sys.stderr.write("%d: at step 4\n" % os.getpid()); sys.stderr.flush()
            fp.seek(0)
            sys.stderr.write("%d: at step 5\n" % os.getpid()); sys.stderr.flush()
            gen = changegroupmod.readbundle(fp, None)

            try:
                sys.stderr.write("%d: at step 6\n" % os.getpid()); sys.stderr.flush()
                r = repo.addchangegroup(gen, 'serve', proto._client())
            except util.Abort, inst:
                sys.stderr.write("abort: %s\n" % inst); sys.stderr.flush()
        finally:
            sys.stderr.write("%d: at step 7\n" % os.getpid()); sys.stderr.flush()
            lock.release()
        sys.stderr.write("%d: at step 8\n" % os.getpid()); sys.stderr.flush()
        return pushres(r)

    finally:
        sys.stderr.write("%d: at step 9\n" % os.getpid()); sys.stderr.flush()
        fp.close()
        sys.stderr.write("%d: at step 10\n" % os.getpid()); sys.stderr.flush()
        os.unlink(tempname)
        sys.stderr.write("%d: at step 11\n" % os.getpid()); sys.stderr.flush()

lock.py:
    try:
        proto.getfile(fp)
        sys.stderr.write("%d: at step 1\n" % os.getpid()); sys.stderr.flush()
        lock = repo.lock()
        sys.stderr.write("%d: at step 2\n" % os.getpid()); sys.stderr.flush()
        try:
            if not check_heads():
                sys.stderr.write("%d: at step 3\n" % os.getpid()); sys.stderr.flush()
                # someone else committed/pushed/unbundled while we
                # were transferring data
                return pusherr('unsynced changes')

            # push can proceed
            sys.stderr.write("%d: at step 4\n" % os.getpid()); sys.stderr.flush()
            fp.seek(0)
            sys.stderr.write("%d: at step 5\n" % os.getpid()); sys.stderr.flush()
            gen = changegroupmod.readbundle(fp, None)

            try:
                sys.stderr.write("%d: at step 6\n" % os.getpid()); sys.stderr.flush()
                r = repo.addchangegroup(gen, 'serve', proto._client())
            except util.Abort, inst:
                sys.stderr.write("abort: %s\n" % inst); sys.stderr.flush()
        finally:
            sys.stderr.write("%d: at step 7\n" % os.getpid()); sys.stderr.flush()
            lock.release()
        sys.stderr.write("%d: at step 8\n" % os.getpid()); sys.stderr.flush()
        return pushres(r)

    finally:
        sys.stderr.write("%d: at step 9\n" % os.getpid()); sys.stderr.flush()
        fp.close()
        sys.stderr.write("%d: at step 10\n" % os.getpid()); sys.stderr.flush()
        os.unlink(tempname)
        sys.stderr.write("%d: at step 11\n" % os.getpid()); sys.stderr.flush()


[2] 
Call sequence, push #1:
13304: at step 1
13304: at step 2
13304: at step 4
13304: at step 5
13304: at step 6
13304: at step 7
13304: at step 101
13304: at step 103
13304: at step 104
13304: at step 105
13304: at step 106
13304: at step 108
13304: at step 109
13304: at step 8
13304: at step 9
13304: at step 10
13304: at step 11
13304: at step 101
13304: at step 109

Call sequence, push #2 (which hangs):
7668: at step 1
7668: at step 101
7668: at step 109
7668: at step 2
7668: at step 3
7668: at step 7
7668: at step 101
7668: at step 103
7668: at step 104
7668: at step 105
7668: at step 106
7668: at step 109
7668: at step 9
7668: at step 10
7668: at step 11
7668: at step 101
7668: at step 109



More information about the Mercurial mailing list