Re: [PATCH 2/3] receive-pack: send pack-processing stderr over sideband

2012-09-21 Thread Jeff King
On Fri, Sep 21, 2012 at 10:25:24AM -0700, Junio C Hamano wrote:

> > However, this does make things more consistent with upload-pack, which
> > connects the stderr of pack-objects to sideband (which it must to handle
> > progress). Furthermore, many of the messages from receive-pack are
> > handled by rp_error, which sends to the sideband. So if you were
> > monitoring your git purely by trying to capture stderr, you were already
> > only getting a fraction of the real data.
> 
> The comments were not meant as a rejection notice ;-) Just to see if
> some server operators have input on the matter.

I know.  But your comment made me second-guess a little whether
anybody would be inadvertently hurt, but thinking it through and writing
it out helped convince myself that it's the right thing to do.

One of the hardest parts of working on a mature software project is not
just thinking about what you want to do, but thinking about what
everyone else wants to do (or is doing). So it never hurts to
double-check your assumptions in such a case, and I don't mind working
through these "what ifs" even if they end in us doing the original
thing. I hope you do not mind reading them too much. :)

> I personally do not think tee-ing the error output is worth it; it
> would be reasonably simple to arrange, and the server operators who
> want it can ask later if that is need.

Agreed.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] receive-pack: send pack-processing stderr over sideband

2012-09-21 Thread Junio C Hamano
Jeff King  writes:

> On Fri, Sep 21, 2012 at 09:49:40AM -0700, Junio C Hamano wrote:
>
>> >   2. No matter what the cause, we are probably better off
>> >  showing the errors to the client. If the client and the
>> >  server admin are not the same entity, it is probably
>> >  much easier for the client to cut-and-paste the errors
>> >  they see than for the admin to try to dig them out of a
>> >  log and correlate them with a particular session.
>> 
>> I agree with the "probably" above (and also with points 1 and 3),
>> but it at the same time feel a bit iffy.  The server side would lose
>> log entries to check when the operator observes higher error rate
>> and starts suspecting something recently broke, and the lost clue
>> cannot be recovered without contacting the pushers, no?
>
> Yeah, that is true, although that is already the case with ssh pushes.
> Conversely, it also means that servers using the ssh transport have lost
> the option of redirecting the server-side stderr (e.g., with a wrapper
> around git-receive-pack) to a log if they were already doing so.

Yes.

> However, this does make things more consistent with upload-pack, which
> connects the stderr of pack-objects to sideband (which it must to handle
> progress). Furthermore, many of the messages from receive-pack are
> handled by rp_error, which sends to the sideband. So if you were
> monitoring your git purely by trying to capture stderr, you were already
> only getting a fraction of the real data.

The comments were not meant as a rejection notice ;-) Just to see if
some server operators have input on the matter.

I personally do not think tee-ing the error output is worth it; it
would be reasonably simple to arrange, and the server operators who
want it can ask later if that is need.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] receive-pack: send pack-processing stderr over sideband

2012-09-21 Thread Jeff King
On Fri, Sep 21, 2012 at 09:49:40AM -0700, Junio C Hamano wrote:

> >   2. No matter what the cause, we are probably better off
> >  showing the errors to the client. If the client and the
> >  server admin are not the same entity, it is probably
> >  much easier for the client to cut-and-paste the errors
> >  they see than for the admin to try to dig them out of a
> >  log and correlate them with a particular session.
> 
> I agree with the "probably" above (and also with points 1 and 3),
> but it at the same time feel a bit iffy.  The server side would lose
> log entries to check when the operator observes higher error rate
> and starts suspecting something recently broke, and the lost clue
> cannot be recovered without contacting the pushers, no?

Yeah, that is true, although that is already the case with ssh pushes.
Conversely, it also means that servers using the ssh transport have lost
the option of redirecting the server-side stderr (e.g., with a wrapper
around git-receive-pack) to a log if they were already doing so.

However, this does make things more consistent with upload-pack, which
connects the stderr of pack-objects to sideband (which it must to handle
progress). Furthermore, many of the messages from receive-pack are
handled by rp_error, which sends to the sideband. So if you were
monitoring your git purely by trying to capture stderr, you were already
only getting a fraction of the real data.

If a server side really did want to capture the error output, I think
the right way to do it would be:

  1. Modify send_sideband to send a copy of all band-2 data to stderr.

  2. Redirect stderr from all processes to a log processor (it's
 tempting to just send it somewhere besides stderr in (1) above, but
 you may also get clients which do not claim to support sidebands,
 in which case we will just spew to stderr).

  3. Do immediate culling on the output before storage, because some of
 what you get will be junk like progress reports (and they all come
 down the same fd, since it is typically stderr from a subprocess).

So I think this patch is not really making anything _worse_ if somebody
wanted to do that. It just moves the messages from being caught by step
(2) to being caught by step (1). But you have to do both either way.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] receive-pack: send pack-processing stderr over sideband

2012-09-21 Thread Junio C Hamano
Jeff King  writes:

> Receive-pack invokes either unpack-objects or index-pack to
> handle the incoming pack. However, we do not redirect the
> stderr of the sub-processes at all, so it is never seen by
> the client. From the initial thread adding sideband support,
> which is here:
>
>   http://thread.gmane.org/gmane.comp.version-control.git/139471
>
> it is clear that some messages are specifically kept off the
> sideband (with the assumption that they are of interest only
> to an administrator, not the client). The stderr of the
> subprocesses is mentioned in the thread, but it's unclear if
> they are included in that group, or were simply forgotten.
>
> However, there are a few good reasons to show them to the
> client:
>
>   1. In many cases, they are directly about the incoming
>  packfile (e.g., fsck warnings with --strict, corruption
>  in the packfile, etc). Without these messages, the
>  client just gets "unpacker error" with no extra useful
>  diagnosis.
>
>   2. No matter what the cause, we are probably better off
>  showing the errors to the client. If the client and the
>  server admin are not the same entity, it is probably
>  much easier for the client to cut-and-paste the errors
>  they see than for the admin to try to dig them out of a
>  log and correlate them with a particular session.

I agree with the "probably" above (and also with points 1 and 3),
but it at the same time feel a bit iffy.  The server side would lose
log entries to check when the operator observes higher error rate
and starts suspecting something recently broke, and the lost clue
cannot be recovered without contacting the pushers, no?

>   3. Users of the ssh transport typically already see these
>  stderr messages, as the remote's stderr is copied
>  literally by ssh. This brings other transports (http,
>  and push-over-git if you are crazy enough to enable it)
>  more in line with ssh. As a bonus for ssh users,
>  because the messages are now fed through the sideband
>  and printed by the local git, they will have "remote:"
>  prepended and be properly interleaved with any local
>  output to stderr.
>
> Signed-off-by: Jeff King 
> ---

Will queue; thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html