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

Re: Auto packing the repository - foreground or background in Windows?

From
Tao Klerks <tao@klerks.biz>
Date
Dec 8, 2022, 14:29 UTC
Message-ID
<CAPMMpojW1mHmZ7_P=JpDZr2JjNxn-Rt_CP5VjtnMVJ6ZDFk36g@mail.gmail.com>
In-Reply-To
<091329e0-9af3-b853-0ed3-edd10d2a2b72@jeffhostetler.com>

Thank you all. I will try to carry forward a patch with this change and a hint about the recommended maintenance approach for longer runs.

On Tue, Dec 6, 2022 at 11:41 PM Jeff Hostetler <git@jeffhostetler.com> wrote:
Show 44 quoted lines
>
>
>
> On 12/6/22 1:03 PM, Derrick Stolee wrote:
> > On 12/1/2022 7:25 AM, Tao Klerks wrote:
> >> But my *question* is: Does anyone know where I could/should look to
> >> understand why the GC was happening in the foreground, even though the
> >> message says it will run in the background?
> >
> > On Windows, Git's foreground process cannot complete without also
> > killing the background process. I'm not sure on the concrete details,
> > but the lack of a background "git gc --auto" here is deliberate for
> > that platform.
>
> Here the GC code uses `daemonize()`.  On Posix this is a wrapper around
> `fork()` where the parent exits and the child continues the computation
> (without stdin/out).
>
> However, `daemonize()` just returns an ENOSYS on Windows, since Windows
> doesn't have `fork()`.  The net result is that the foreground process
> falls thru and does the actual work.
>
>
> [...]
> > Instead, the modern recommendation for repositories where "git gc --auto"
> > would be slow is to run "git maintenance start" which will schedule
> > background maintenance jobs with the Windows scheduler. Those processes
> > are built to do updates that are non-invasive to concurrent foreground
> > processes. It also sets config to avoid "git gc --auto" commands at the
> > end of foreground Git processes.
> >
> > See [1] for more details.
> >
> > [1] https://git-scm.com/docs/git-maintenance
>
> It is possible to do the GC in the background on Windows (using other
> techniques), but I don't think it is worth the bother now that we have
> `git maintenance` to handle it.
>
> And yes, AEvar's suggested fix for printing the correct error message
> looks helpful.
>
>
> Jeff
Previous: Jeff HostetlerNext: Tao Klerks
Message 5 of 7 in “Auto packing the repository - foreground or background in Windows?”
  1. Tao KlerksDec 1, 2022
  2. Derrick StoleeDec 6, 2022
  3. Ævar Arnfjörð BjarmasonDec 6, 2022
  4. Jeff HostetlerDec 6, 2022
  5. Tao KlerksDec 8, 2022
  6. Tao KlerksDec 8, 2022
  7. Derrick StoleeDec 9, 2022

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.