Skip to contentSkip to conversation

Commit generates GC repack failure

Possible Bug Randall S. Becker 3 participants 5 messages Jan 14, 2019

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 14 lines · Randall S. Becker

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.
Quoted 1 line

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.

Quoted 17 lines

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.

Signature · 1 line
Duy
#2 lore raw
Quoted 17 lines · Duy Nguyen
Quoted 14 lines · Randall S. Becker

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.
Quoted 5 lines
Quoted 1 line

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

Signature · 1 line
Duy
#3 lore raw
In reply to Randall S. Becker
Quoted 13 lines · Randall S. Becker

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.
Quoted 6 lines

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?

#4 lore raw
Quoted 20 lines · Ævar Arnfjörð Bjarmason
Quoted 12 lines · Randall S. Becker

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.
Quoted 6 lines

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

Quoted 8 lines

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