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

status hangs trying to get submodule summary

From
Wincent Colaiuta <win@wincent.com>
Date
Mar 22, 2015, 05:56 UTC
Message-ID
<CAPx-p4sKD0Nut3E1jnWfPPx4=--ZOxBgiVdt3RRb5tktw31qDg@mail.gmail.com>
Hi,

I just ran into some odd behavior trying to update a submodule in one of my projects where it would hang indefinitely trying to run either `git status` or `git commit`.

Here's the minimal repro recipe:

mkdir demo cd demo git init git submodule add git://github.com/ansible/ansible.git ansible (cd ansible && git checkout v1.6.10) git add ansible git commit -m "initial commit" (cd ansible && git checkout v1.8.4) git config status.submodulesummary true git status # hangs... git commit # hangs...

At the time `git status` is hanging, these are the Git processes running on the system:

12431 git status 12462 git submodule summary --files --for-status --summary-limit -1 12463 /bin/sh /usr/libexec/git-core/git-submodule summary --files --for-status --summary-limit -1 12507 /bin/sh /usr/libexec/git-core/git-submodule summary --files --for-status --summary-limit -1 12522 git log --pretty=format: %m %s --first-parent 8959338284f6c6e44890b8911434285848f34859...ebc8d48d34296fe010096f044e2b7591df37a622

And `strace` shows the processes `wait4`-ing, except for the `git log` one which is doing a `write` but apparently blocked:

# strace -p 12431
Process 12431 attached
wait4(12462, ^CProcess 12431 detached
 <detached ...>
# strace -p 12462
Process 12462 attached
wait4(12463, ^CProcess 12462 detached
 <detached ...>
# strace -p 12463
Process 12463 attached
wait4(-1, ^CProcess 12463 detached
 <detached ...>
# strace -p 12507
Process 12507 attached
wait4(-1, ^CProcess 12507 detached
 <detached ...>
# strace -p 12522
Process 12522 attached
write(1, "\n  > Merge pull request #7814 fr"..., 108^CProcess 12522 detached
 <detached ...>

This repros for me on Mac OS X 10.10.2 with Git 1.9.5 and Git 2.3.3, and on the Amazon LInux (a RHEL-like OS) with Git 2.1.0. Both of these with an empty .gitconfig (other than user.email, user.name and the status.submodulesummary value already mentioned above).

I've never seen this hang before despite frequent use of submodules. Oddly, I was able to work around the hang by moving the submodule in two hops (one from Ansible v1.6.10 to v1.7.0, then from v1.7.0 to v1.8.4). I am not sure if this is specific to the Ansible repo, or whether the length of the summary is crossing some threshold that triggers the bug to manifest. If I run the forked commands manually from an interactive shell, they complete just fine.

-Greg
Next: Jeff King
Message 1 of 26 in “status hangs trying to get submodule summary”
  1. Wincent ColaiutaMar 22, 2015
  2. status: read submodule process output before calling wait()Jeff King, Mar 22, 2015
  3. Jeff KingMar 22, 2015
  4. 0/7 introduce strbuf_read_cmd to avoid deadlocksJeff King, Mar 22, 2015
  5. 1/7 wt-status: don't flush before running "submodule status"Jeff King, Mar 22, 2015
  6. 2/7 wt_status: fix signedness mismatch in strbuf_read callJeff King, Mar 22, 2015
  7. 3/7 strbuf: introduce strbuf_read_cmd helperJeff King, Mar 22, 2015
  8. Eric SunshineMar 22, 2015
  9. Junio C HamanoMar 22, 2015
  10. Junio C HamanoMar 22, 2015
  11. 0/7 introduce capture_command to avoid deadlocksJeff King, Mar 23, 2015
  12. 1/7 wt-status: don't flush before running "submodule status"Jeff King, Mar 23, 2015
  13. 2/7 wt_status: fix signedness mismatch in strbuf_read callJeff King, Mar 23, 2015
  14. 3/7 run-command: introduce capture_command helperJeff King, Mar 23, 2015
  15. 4/7 wt-status: use capture_commandJeff King, Mar 23, 2015
  16. 5/7 submodule: use capture_commandJeff King, Mar 23, 2015
  17. 6/7 trailer: use capture_commandJeff King, Mar 23, 2015
  18. 7/7 run-command: forbid using run_command with piped outputJeff King, Mar 23, 2015
  19. Junio C HamanoMar 23, 2015
  20. Jeff KingMar 22, 2015
  21. Junio C HamanoMar 22, 2015
  22. Jeff KingMar 22, 2015
  23. 4/7 wt-status: use strbuf_read_cmdJeff King, Mar 22, 2015
  24. 5/7 submodule: use strbuf_read_cmdJeff King, Mar 22, 2015
  25. 6/7 trailer: use strbuf_read_cmdJeff King, Mar 22, 2015
  26. 7/7 run-command: forbid using run_command with piped outputJeff King, Mar 22, 2015

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.