deadlock git upload-pack command when GIT_TRACE is enabled
- From
- Eugene Petrenko <eugene.petrenko@gmail.com>
- Date
- May 9, 2016, 17:49 UTC
- Message-ID
- <CAJNyVBAr7dJFxXA2+dXCJUMs=mB9u3-Ja7r4wemk9C_HBZ3W2A@mail.gmail.com>
Hello,
I stuck around the deadlock inside git when running git upload-pack . command. A debugging shown that the bottom process (it starts several processes to implement the task) hangs writing to stderr. I managed to reproduce the issue with a tiny bash script. The repository and the script is found here https://github.com/jonnyzzz/git-upload-pack-deadlock
I saw the issue reproducing both under Windows and Linux/Mac.
Windows thread dumps are available here https://github.com/jonnyzzz/git-upload-pack-deadlock/tree/master/debug
According to those thread dumps I see the following problem around upload-pack.c line 129. There the pack_objects command is executed. First the wants block is pushed to the command, next the stdout processing is started. This means, that pack_objects process output is not processed until all output is put there. In the case I have, the pack_objects process writes TRACE logging into stderr and eventually (on hug repo) the OS buffer runs-out deadlocking the execution.
Best regards, Eugene Petrenko