From: "Robin Jarry" <robin.jarry@6wind.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Emily Shaffer" <emilyshaffer@google.com>, <git@vger.kernel.org>,
"Nicolas Dichtel" <nicolas.dichtel@6wind.com>,
"Patryk Obara" <patryk.obara@gmail.com>,
"Jiang Xin" <zhiyou.jx@alibaba-inc.com>
Subject: Re: [PATCH v2] receive-pack: add option to interrupt pre-receive when client exits
Date: Thu, 27 Jan 2022 21:53:32 +0100 [thread overview]
Message-ID: <CHGR6XNP6TV7.15VGVNQUJM9J6@diabtop> (raw)
In-Reply-To: <xmqqr18t2fxl.fsf@gitster.g>
Junio C Hamano, Jan 27, 2022 at 19:26:
> Sorry, but I was (and am) questioning why we want to do more than
> "let it be killed by SIGPIPE, just like we used to do before
> ec7dbd14 (receive-pack: allow hooks to ignore its standard input
> stream, 2014-09-12) introduced the current behaviour", so the answer
> is still "why do we even need to complicate the thing with keepalive
> or anything we don't have, and we didn't have before ec7dbd14, in
> the code paths that are involved?"
My main goal is to abort a push if a user hits ctrl-c (or is
disconnected) before the objects have been moved to permanent storage.
(partially) reverting to previous behavior would only allow aborting
pushes *if* the pre-receive hook sends some output and this output
cannot be forwarded to the client. There is no guarantee that the hook
will send any output. Also, it would restore hard to track issue with
poorly written pre-receive hooks.
I wonder if it would be possible to not rely on the pre-receive hook
sending output and this output somehow not being forwarded to the
client.
Instead, explicitly check if the client is still connected and alive
after the pre-receive hook has exited but before completing the push
transaction. That was my intent with that (invalid by the way) keepalive
example.
I do not know git internals to say if it feasible without any protocol
breakage. My attempts work well for aborting pushes:
Writing objects: 100% (3/3), 321 bytes | 321.00 KiB/s, done.
Total 3 (delta 1), reused 1 (delta 0), pack-reused 0
remote: pre-receive start^C
<--- client has disconnected
receive-pack fails to send the "keepalive" packet
the temp objects are *not* migrated to permanent storage
But this always leads to errors on the client side when receive-pack
sends the "keepalive packet":
Writing objects: 100% (3/3), 321 bytes | 321.00 KiB/s, done.
Total 3 (delta 1), reused 1 (delta 0), pack-reused 0
remote: pre-receive start
remote: pre-receive end OK
error: unexpected flush packet while reading remote unpack status
error: invalid ref status from remote: unpack
remote: post-receive start
remote: post-receive end OK
To git@host:repo.git
! [remote failure] main -> main (remote failed to report status)
error: failed to push some refs to 'git@host:repo.git'
Am I chasing rainbows or is that possible in the current state of the
git protocol? Maybe I need to send the keepalive packet in a sideband?
I have read the technical docs several times but I cannot understand how
everything works properly.
Thank you for your time.
next prev parent reply other threads:[~2022-01-27 20:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 9:54 [PATCH] receive-pack: interrupt pre-receive when client disconnects Robin Jarry
2022-01-26 7:17 ` Jiang Xin
2022-01-26 12:46 ` Robin Jarry
2022-01-26 21:44 ` [PATCH v2] receive-pack: add option to interrupt pre-receive when client exits Robin Jarry
2022-01-27 3:21 ` Jiang Xin
2022-01-27 8:38 ` Robin Jarry
2022-01-27 4:36 ` Junio C Hamano
2022-01-27 9:32 ` Robin Jarry
2022-01-27 18:26 ` Junio C Hamano
2022-01-27 20:53 ` Robin Jarry [this message]
2022-01-27 21:55 ` [PATCH v3] receive-pack: check if client is alive before completing the push Robin Jarry
2022-01-28 1:19 ` Junio C Hamano
2022-01-28 9:13 ` Robin Jarry
2022-01-28 17:52 ` Junio C Hamano
2022-01-28 19:32 ` Robin Jarry
2022-01-28 19:48 ` [PATCH v4] " Robin Jarry
2022-02-04 11:37 ` Ævar Arnfjörð Bjarmason
2022-02-04 19:19 ` Junio C Hamano
2022-02-07 19:26 ` Robin Jarry
2022-01-27 23:47 ` [PATCH v2] receive-pack: add option to interrupt pre-receive when client exits Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CHGR6XNP6TV7.15VGVNQUJM9J6@diabtop \
--to=robin.jarry@6wind.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nicolas.dichtel@6wind.com \
--cc=patryk.obara@gmail.com \
--cc=zhiyou.jx@alibaba-inc.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).