All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Smets <jan.smets@nokia.com>
To: <git@vger.kernel.org>
Cc: Stephen Morton <stephen.morton@nokia.com>, <peff@peff.net>
Subject: Client exit whilst running pre-receive hook : commit accepted but no post-receive hook ran
Date: Mon, 25 Jul 2016 12:34:04 +0200	[thread overview]
Message-ID: <5795EB1C.1080102@nokia.com> (raw)

Hi

I have always assumed the post-receive hook to be executed whenever a 
commit is "accepted" by the (gitolite) server. That does not seem to be 
true any more.

Since 9658846 is appears that, when a client bails out, the pre-receive 
hook continues to run and the commit is written to the repository, but 
no post-receive hook is executed. No signal of any kind is received in 
the hook, not even a sig pipe when the post- hook is writing to stdout 
whilst the client has disconnected.


commit 9658846ce3d379b9ff8010a2ed326fcafc10eb82
Author: Jeff King <peff@peff.net>
Date:   Wed Feb 24 02:40:16 2016 -0500

     write_or_die: handle EPIPE in async threads

diff --git a/write_or_die.c b/write_or_die.c
...
  static void check_pipe(int err)
  {
         if (err == EPIPE) {
+               if (in_async())
+                       async_exit(141);



Please keep me in CC as I am not subscribed to the list.

Thanks
Jan



The pre-receive hook from my quick testing => press Ctrl-C on the client 
when it is busy processing the 'sleep 5'
In my testing I was committing/pushing 32MB+ binary files that take some 
time to process.

#!/bin/bash
trap 'echo TRAP >> /tmp/gittest/log' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
IN=$(cat /dev/stdin)

echo -n $(date) >> /tmp/gittest/log
echo " : PRE START"  >> /tmp/gittest/log

for i in $(seq 1 10); do
   echo This is the pre-receive hook $i; sleep 0.1
done

# give time for client to ctrl-c out
sleep 5

echo -n $(date) >> /tmp/gittest/log
echo " : PRE END"  >> /tmp/gittest/log

# This should result in a sigpipe? but it isn't.
echo "Done !"
echo "Done !"

# no exit code -> accept commit




             reply	other threads:[~2016-07-25 10:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-25 10:34 Jan Smets [this message]
2016-07-25 22:22 ` Client exit whilst running pre-receive hook : commit accepted but no post-receive hook ran Jeff King
2016-08-02 16:01   ` Stephen Morton
2016-08-03 19:30     ` Jeff King
2016-08-03 19:54       ` Junio C Hamano
2016-08-04  0:35         ` Stephen Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5795EB1C.1080102@nokia.com \
    --to=jan.smets@nokia.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=stephen.morton@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.