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

Re: [PATCH v2 7/7] t/helper/simple-ipc: convert test-simple-ipc to use start_bg_command

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 9, 2021, 23:01 UTC
Message-ID
<nycvar.QRO.7.76.6.2111092358240.54@tvgsbejvaqbjf.bet>
In-Reply-To
<dca03da9-5684-10c7-2315-2d10affd4f0a@ramsayjones.plus.com>
Hi Ramsay,
On Tue, 9 Nov 2021, Ramsay Jones wrote:
Show 26 quoted lines
> On 08/11/2021 23:59, Johannes Schindelin wrote:
> [snip]
> > I had a look at this and could reproduce... partially. I only managed to
> > make it fail every once in a while.
> >
> > Digging deeper, it turns out that the `lstat()` call in
> > `ipc_get_active_state()` does not receive an `st_mode` indicating a
> > socket, but rather a file (in my tests, it was usually 0100644, but
> > sometimes even 0100755).
> >
> > The reason is, of course, that Cygwin _emulates_ Unix sockets. What is in
> > the file system is just a special file, it is marked with the `system` bit
> > (which only exists on Windows), and its contents start with the tell-tale
> > `!<socket>`.
> >
> > And as you might have guessed, there is a race going on between Cygwin
> > writing that file _and_ flipping that `system` bit, and Git trying to
> > access the Unix socket and encountering an unexpected file.
> >
> > Now, why this only happens in your 32-bit setup, I have no idea.
> >
> > In my tests, the following patch works around the issue. Could I ask you
> > to test it in your environment?
>
> Just FYI, I just tried the patch below (on 64-bit cygwin) and this test
> now works fine for me. (well, run 5 times by hand - not with --stress).
Very good!

I fear that it is a bit late in the -rc cycle to try to get this into the official v2.34.0. Adam, since you are the maintainer of the Cygwin git package, would you mind incorporating this patch into Cygwin's version of Git?

Show 7 quoted lines
> This is on windows 10 21H1 and cygwin:
>
>   $ uname -a
>   CYGWIN_NT-10.0 satellite 3.3.2(0.341/5/3) 2021-11-08 16:55 x86_64 Cygwin
>   $
>
> [Yes, I updated last night!]

Good thing, too: v3.3.2 fixes a critical bug in the pipe code. One symptom was that you could not use Git Credential Manager Core as credential helper (because Git thought that the helper had hung up, well before the helper sent any information).

Ciao, Dscho

Show 46 quoted lines
>
> ATB,
> Ramsay Jones
>
> > -- snip --
> > diff --git a/compat/simple-ipc/ipc-unix-socket.c
> > b/compat/simple-ipc/ipc-unix-socket.c
> > index 4e28857a0a..1c591b2adf 100644
> > --- a/compat/simple-ipc/ipc-unix-socket.c
> > +++ b/compat/simple-ipc/ipc-unix-socket.c
> > @@ -36,6 +36,23 @@ enum ipc_active_state ipc_get_active_state(const char
> > *path)
> >  	}
> >
> >  	/* also complain if a plain file is in the way */
> > +#ifdef __CYGWIN__
> > +	{
> > +		static const int delay[] = { 1, 10, 20, 40, -1 };
> > +		int i;
> > +
> > +		for (i = 0; S_ISREG(st.st_mode) && delay[i] > 0; i++) {
> > +			/*
> > +			 * Cygwin might still be in the process of marking the
> > +			 * underlying file as a system file.
> > +			 */
> > +			sleep_millisec(delay[i]);
> > +			if (lstat(path, &st) == -1)
> > +				return IPC_STATE__INVALID_PATH;
> > +		}
> > +	}
> > +#endif
> > +
> >  	if ((st.st_mode & S_IFMT) != S_IFSOCK)
> >  		return IPC_STATE__INVALID_PATH;
> >
> > -- snap --
> >
> > FWIW it looks as if the loop might be a bit of an overkill, as I could not
> > get the code to need more than a single one-millisecond sleep, but it's
> > probably safer to just keep the delay loop in place as-is.
> >
> > Ciao,
> > Dscho
> >
>
>
Previous: Ramsay JonesNext: Junio C Hamano
Message 51 of 66 in “Builtin FSMonitor Part 1”
  1. 0/7 Builtin FSMonitor Part 1Jeff Hostetler via GitGitGadget, Sep 15, 2021
  2. 4/7 simple-ipc/ipc-win32: add trace2 debuggingJeff Hostetler via GitGitGadget, Sep 15, 2021
  3. Ævar Arnfjörð BjarmasonSep 16, 2021
  4. Jeff HostetlerSep 17, 2021
  5. 6/7 run-command: create start_bg_commandJeff Hostetler via GitGitGadget, Sep 15, 2021
  6. Taylor BlauSep 16, 2021
  7. Taylor BlauSep 16, 2021
  8. Ævar Arnfjörð BjarmasonSep 16, 2021
  9. 5/7 simple-ipc/ipc-win32: add Windows ACL to named pipeJeff Hostetler via GitGitGadget, Sep 15, 2021
  10. Ævar Arnfjörð BjarmasonSep 16, 2021
  11. Jeff HostetlerSep 17, 2021
  12. Ævar Arnfjörð BjarmasonSep 17, 2021
  13. 1/7 trace2: fix memory leak of thread nameJeff Hostetler via GitGitGadget, Sep 15, 2021
  14. Junio C HamanoSep 15, 2021
  15. Taylor BlauSep 16, 2021
  16. Ævar Arnfjörð BjarmasonSep 16, 2021
  17. Taylor BlauSep 16, 2021
  18. Ævar Arnfjörð BjarmasonSep 16, 2021
  19. Jeff HostetlerSep 16, 2021
  20. Ævar Arnfjörð BjarmasonSep 16, 2021
  21. Junio C HamanoSep 16, 2021
  22. 3/7 simple-ipc: move definition of ipc_active_state outside of ifdefJeff Hostetler via GitGitGadget, Sep 15, 2021
  23. Junio C HamanoSep 15, 2021
  24. Jeff HostetlerSep 17, 2021
  25. Carlo ArenasSep 18, 2021
  26. Junio C HamanoSep 20, 2021
  27. 2/7 simple-ipc: preparations for supporting binary messages.Jeff Hostetler via GitGitGadget, Sep 15, 2021
  28. Eric SunshineSep 15, 2021
  29. Jeff HostetlerSep 17, 2021
  30. 7/7 t/helper/simple-ipc: convert test-simple-ipc to use start_bg_commandJeff Hostetler via GitGitGadget, Sep 15, 2021
  31. Taylor BlauSep 16, 2021
  32. Jeff HostetlerSep 17, 2021
  33. Ævar Arnfjörð BjarmasonSep 18, 2021
  34. Ævar Arnfjörð BjarmasonSep 16, 2021
  35. 0/7 Builtin FSMonitor Part 1Jeff Hostetler via GitGitGadget, Sep 20, 2021
  36. 1/7 trace2: add trace2_child_ready() to report on background childrenJeff Hostetler via GitGitGadget, Sep 20, 2021
  37. 2/7 simple-ipc: preparations for supporting binary messages.Jeff Hostetler via GitGitGadget, Sep 20, 2021
  38. 3/7 simple-ipc: move definition of ipc_active_state outside of ifdefJeff Hostetler via GitGitGadget, Sep 20, 2021
  39. 4/7 simple-ipc/ipc-win32: add trace2 debuggingJeff Hostetler via GitGitGadget, Sep 20, 2021
  40. 6/7 run-command: create start_bg_commandJeff Hostetler via GitGitGadget, Sep 20, 2021
  41. 5/7 simple-ipc/ipc-win32: add Windows ACL to named pipeJeff Hostetler via GitGitGadget, Sep 20, 2021
  42. 7/7 t/helper/simple-ipc: convert test-simple-ipc to use start_bg_commandJeff Hostetler via GitGitGadget, Sep 20, 2021
  43. Ævar Arnfjörð BjarmasonSep 23, 2021
  44. Jeff HostetlerSep 23, 2021
  45. Junio C HamanoSep 23, 2021
  46. Adam DinwoodieNov 4, 2021
  47. Ramsay JonesNov 4, 2021
  48. Jeff HostetlerNov 8, 2021
  49. Johannes SchindelinNov 8, 2021
  50. Ramsay JonesNov 9, 2021
  51. Johannes SchindelinNov 9, 2021
  52. Junio C HamanoNov 9, 2021
  53. Johannes SchindelinNov 10, 2021
  54. Adam DinwoodieNov 12, 2021
  55. Junio C HamanoNov 12, 2021
  56. Adam DinwoodieNov 12, 2021
  57. Johannes SchindelinNov 16, 2021
  58. Johannes SchindelinNov 16, 2021
  59. Ramsay JonesNov 13, 2021
  60. Ramsay JonesNov 14, 2021
  61. Adam DinwoodieNov 14, 2021
  62. Ævar Arnfjörð BjarmasonSep 23, 2021
  63. Jeff HostetlerSep 23, 2021
  64. Ævar Arnfjörð BjarmasonSep 23, 2021
  65. Jeff HostetlerSep 27, 2021
  66. Taylor BlauSep 23, 2021

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.