# [Possible Bug] Commit generates GC repack failure

5 messages from 2019-01-14 to 2019-01-14. Participants: Randall S. Becker, Duy Nguyen, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/50220

## Randall S. Becker, 2019-01-14 14:50

Subject: [Possible Bug] Commit generates GC repack failure
Message-ID: <002601d4ac18$83d4a210$8b7de630$@nexbridge.com>
URL: https://gitlist.dev/e/002601d4ac18%2483d4a210%248b7de630%24%40nexbridge.com

```
Hi All,

I'm trying to track down what happened this morning. We had a commit that
caused a background gc to occur. What happened was:

$ git commit -m "history commit ... "
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root
cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

fatal: open /dev/null failed: Invalid function argument
fatal: failed to run repack

Obviously the /dev/null open was not right, but I don't know where this is
in the git code to investigate further. Any pointers on where to look would
be appreciated. This started happening at  2.20.1 on the NonStop platform.

Cheers,
Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.





```

## Duy Nguyen, 2019-01-14 15:03

Subject: Re: [Possible Bug] Commit generates GC repack failure
Message-ID: <CACsJy8AEi4gzRpHY+ehFz3GEOaQ0rmdC2kKMpUSp80cdQbuc6g@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8AEi4gzRpHY%2BehFz3GEOaQ0rmdC2kKMpUSp80cdQbuc6g%40mail.gmail.com
In-Reply-To: <002601d4ac18$83d4a210$8b7de630$@nexbridge.com>

```
On Mon, Jan 14, 2019 at 9:51 PM Randall S. Becker
<rsbecker@nexbridge.com> wrote:
>
> Hi All,
>
> I'm trying to track down what happened this morning. We had a commit that
> caused a background gc to occur. What happened was:
>
> $ git commit -m "history commit ... "
> Auto packing the repository in background for optimum performance.
> See "git help gc" for manual housekeeping.
> warning: The last gc run reported the following. Please correct the root
> cause
> and remove .git/gc.log.
> Automatic cleanup will not be performed until the file is removed.
>
> fatal: open /dev/null failed: Invalid function argument

sanitize_stdfds() in setup.c can attempt to open /dev/null then
redirect stdout and stderr to it. I think this is part of the
daemonization that is done in background gc.

> fatal: failed to run repack
>
> Obviously the /dev/null open was not right, but I don't know where this is
> in the git code to investigate further. Any pointers on where to look would
> be appreciated. This started happening at  2.20.1 on the NonStop platform.
>
> Cheers,
> Randall
>
> -- Brief whoami:
>  NonStop developer since approximately 211288444200000000
>  UNIX developer since approximately 421664400
> -- In my real life, I talk too much.
>
>
>
>


-- 
Duy

```

## Duy Nguyen, 2019-01-14 15:07

Subject: Re: [Possible Bug] Commit generates GC repack failure
Message-ID: <CACsJy8AtyTDs25R2PBd+nAvCW9aCYxtPHdXTS57JSS5VzgSFwQ@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8AtyTDs25R2PBd%2BnAvCW9aCYxtPHdXTS57JSS5VzgSFwQ%40mail.gmail.com
In-Reply-To: <CACsJy8AEi4gzRpHY+ehFz3GEOaQ0rmdC2kKMpUSp80cdQbuc6g@mail.gmail.com>

```
On Mon, Jan 14, 2019 at 10:03 PM Duy Nguyen <pclouds@gmail.com> wrote:
>
> On Mon, Jan 14, 2019 at 9:51 PM Randall S. Becker
> <rsbecker@nexbridge.com> wrote:
> >
> > Hi All,
> >
> > I'm trying to track down what happened this morning. We had a commit that
> > caused a background gc to occur. What happened was:
> >
> > $ git commit -m "history commit ... "
> > Auto packing the repository in background for optimum performance.
> > See "git help gc" for manual housekeeping.
> > warning: The last gc run reported the following. Please correct the root
> > cause
> > and remove .git/gc.log.
> > Automatic cleanup will not be performed until the file is removed.
> >
> > fatal: open /dev/null failed: Invalid function argument
>
> sanitize_stdfds() in setup.c can attempt to open /dev/null then
> redirect stdout and stderr to it. I think this is part of the
> daemonization that is done in background gc.

However the message does not match. I think you will find this "open
/dev/null failed" line in run-command.c
-- 
Duy

```

## Ævar Arnfjörð Bjarmason, 2019-01-14 15:11

Subject: Re: [Possible Bug] Commit generates GC repack failure
Message-ID: <87tvib46kr.fsf@evledraar.gmail.com>
URL: https://gitlist.dev/e/87tvib46kr.fsf%40evledraar.gmail.com
In-Reply-To: <002601d4ac18$83d4a210$8b7de630$@nexbridge.com>

```

On Mon, Jan 14 2019, Randall S. Becker wrote:

> Hi All,
>
> I'm trying to track down what happened this morning. We had a commit that
> caused a background gc to occur. What happened was:
>
> $ git commit -m "history commit ... "
> Auto packing the repository in background for optimum performance.
> See "git help gc" for manual housekeeping.
> warning: The last gc run reported the following. Please correct the root
> cause
> and remove .git/gc.log.
> Automatic cleanup will not be performed until the file is removed.
>
> fatal: open /dev/null failed: Invalid function argument
> fatal: failed to run repack
>
> Obviously the /dev/null open was not right, but I don't know where this is
> in the git code to investigate further. Any pointers on where to look would
> be appreciated. This started happening at  2.20.1 on the NonStop platform.

We use start_command() when gc does run_command_v_opt() of
e.g. git-repack. See in that file:

    null_fd = open("/dev/null", O_RDWR | O_CLOEXEC)

Maybe that sort of code just fails on NonStop?

```

## Randall S. Becker, 2019-01-14 16:09

Subject: RE: [Possible Bug] Commit generates GC repack failure
Message-ID: <003601d4ac23$91ff2f80$b5fd8e80$@nexbridge.com>
URL: https://gitlist.dev/e/003601d4ac23%2491ff2f80%24b5fd8e80%24%40nexbridge.com
In-Reply-To: <87tvib46kr.fsf@evledraar.gmail.com>

```
On January 14, 2019 10:12, Ævar Arnfjörð Bjarmason wrote:
> On Mon, Jan 14 2019, Randall S. Becker wrote:
> 
> > Hi All,
> >
> > I'm trying to track down what happened this morning. We had a commit
> > that caused a background gc to occur. What happened was:
> >
> > $ git commit -m "history commit ... "
> > Auto packing the repository in background for optimum performance.
> > See "git help gc" for manual housekeeping.
> > warning: The last gc run reported the following. Please correct the
> > root cause and remove .git/gc.log.
> > Automatic cleanup will not be performed until the file is removed.
> >
> > fatal: open /dev/null failed: Invalid function argument
> > fatal: failed to run repack
> >
> > Obviously the /dev/null open was not right, but I don't know where
> > this is in the git code to investigate further. Any pointers on where
> > to look would be appreciated. This started happening at  2.20.1 on the
> NonStop platform.
> 
> We use start_command() when gc does run_command_v_opt() of e.g. git-
> repack. See in that file:
> 
>     null_fd = open("/dev/null", O_RDWR | O_CLOEXEC)
> 
> Maybe that sort of code just fails on NonStop?

That line of code works fine on the platform. I tested it in isolation at various OS levels. Let me go back and say that I'm not 100% sure this is new, but may have been there since just before 2.16. Still perplexed recognizing that that is the only point in git code where that can happen.

Cheers,
Randall


```
