git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: t5401-update-hooks test failure

From
Nicolas Pitre <nico@fluxnic.net>
Date
Feb 9, 2010, 19:20 UTC
Message-ID
<alpine.LFD.2.00.1002091337421.1681@xanadu.home>
In-Reply-To
<20100209175139.GA28936@spearce.org>
On Tue, 9 Feb 2010, Shawn O. Pearce wrote:
Show 46 quoted lines
> Junio C Hamano <gitster@pobox.com> wrote:
> > $ while sh t5401-*.sh -i; do :; done
> > ... wait for a while ...
> > * FAIL 12: send-pack stderr contains hook messages
> > 
> >                 grep ^remote: send.err | sed "s/ *\$//" >actual &&
> >                 test_cmp - actual <expect
> > 
> > $ t/(364643e...); cat trash\ directory.t5401-update-hooks/actual 
> > remote: STDOUT pre-receive
> > remote: STDERR pre-receive
> > remote: STDOUT update refs/heads/master
> > remote: STDERR update refs/heads/master
> > remote: STDOUT update refs/heads/tofail
> > remote: STDOUT post-receive
> > remote: STDERR post-receive
> > remote: STDOUT post-update
> > remote: STDERR post-update
> > $ t/(364643e...); cat trash\ directory.t5401-update-hooks/expect 
> > remote: STDOUT pre-receive
> > remote: STDERR pre-receive
> > remote: STDOUT update refs/heads/master
> > remote: STDERR update refs/heads/master
> > remote: STDOUT update refs/heads/tofail
> > remote: STDERR update refs/heads/tofail
> > remote: STDOUT post-receive
> > remote: STDERR post-receive
> > remote: STDOUT post-update
> > remote: STDERR post-update
> 
> A quick visual inspection shows that only the STDERR tofail message
> is missing here.  That sounds to me like a race condition in the
> recv_sideband decoder.  Or, a race condition in the hook code in
> builtin-receive-pack.c.
> 
> I doubt its in receive-pack. run_update_hook() directly calls the
> copy_to_sideband() function, and that reads until EOF on the hook's
> stderr stream before it returns and waits for the hook's exit status.
> So we should be pulling everything and dumping it into the sideband.
> 
> builtin-send-pack.c clearly isn't stopping early while processing
> the stream, since we see later messages from the post-receive and
> post-update hooks just fine.
> 
> So I think the only code that is in question is the case 2 arm of
> recv_sideband().  But to be honest, I can't find any fault with it.

Note that strict order of messages passed through the sideband can't be relied upon. Often you have sideband 1 connected to stdin and sideband 2 connected to stderr, and they are linked with pipes, and various factors such as stdio buffering or even printf implementation in the C lib, pipe buffers in the OS, random scheduling between the processes involved, and other factors such as disk or network speed vs CPU speed, are all adding to a certain degree of randomness affecting how the data end up in various channels wrt each other.

See my efforts to reduce that issue so far with those commits:
6b59f51b312f06d9420d34c09fa408c658aac6d2
6b9c42b4daabe3d0471d9f90d2ae472c9d994e1c
d048a96ee9bec968be0bdc9c43ffce61169545be
ebe8fa738dcf6911fe520adce0cfa0cb26dee5e2
Nicolas
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 24 of 45 in “git-push: fix an error message so it goes to stderr”
  1. 1/3 git-push: fix an error message so it goes to stderrLarry D'Anna, Feb 8, 2010
  2. 2/3 git-push: clean up some of the output from git push --porcelainLarry D'Anna, Feb 8, 2010
  3. Junio C HamanoFeb 8, 2010
  4. Junio C HamanoFeb 8, 2010
  5. Jeff KingFeb 8, 2010
  6. Larry D'AnnaFeb 8, 2010
  7. Junio C HamanoFeb 8, 2010
  8. Larry D'AnnaFeb 8, 2010
  9. git-push: clean up some of the output from git pushLarry D'Anna, Feb 8, 2010
  10. Junio C HamanoFeb 8, 2010
  11. Larry D'AnnaFeb 8, 2010
  12. Junio C HamanoFeb 8, 2010
  13. git-push: fix the documentation to explain all the status flagsLarry D'Anna, Feb 8, 2010
  14. Junio C HamanoFeb 9, 2010
  15. Junio C HamanoFeb 9, 2010
  16. Junio C HamanoFeb 9, 2010
  17. Larry D'AnnaFeb 9, 2010
  18. Junio C HamanoFeb 9, 2010
  19. Larry D'AnnaFeb 9, 2010
  20. Larry D'AnnaFeb 9, 2010
  21. Junio C HamanoFeb 9, 2010
  22. Larry D'AnnaFeb 9, 2010
  23. Shawn O. PearceFeb 9, 2010
  24. Nicolas PitreFeb 9, 2010
  25. Shawn O. PearceFeb 9, 2010
  26. Junio C HamanoFeb 9, 2010
  27. Junio C HamanoFeb 9, 2010
  28. Shawn O. PearceFeb 10, 2010
  29. Larry D'AnnaFeb 9, 2010
  30. Jeff KingFeb 10, 2010
  31. Larry D'AnnaFeb 10, 2010
  32. Tay Ray ChuanFeb 10, 2010
  33. Junio C HamanoFeb 8, 2010
  34. Jeff KingFeb 10, 2010
  35. Junio C HamanoFeb 11, 2010
  36. Jeff KingFeb 12, 2010
  37. 3/3 git-push: make git push --dry-run --porcelain exit with status 0 even if updates will be rejectedLarry D'Anna, Feb 8, 2010
  38. Junio C HamanoFeb 8, 2010
  39. Larry D'AnnaFeb 8, 2010
  40. Junio C HamanoFeb 9, 2010
  41. Larry D'AnnaFeb 10, 2010
  42. 4/4 git-push: make git push --dry-run --porcelain exit with status 0 even if updates will be rejectedLarry D'Anna, Feb 10, 2010
  43. Larry D'AnnaFeb 15, 2010
  44. Junio C HamanoFeb 15, 2010
  45. Junio C HamanoFeb 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.