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

Re: git-commit fatal: Out of memory? mmap failed: Bad file descriptor

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Jan 12, 2008, 00:43 UTC
Message-ID
<47880D18.8030405@nrlssc.navy.mil>
In-Reply-To
<7vve5z2abv.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 7 quoted lines
> Brandon Casey <casey@nrlssc.navy.mil> writes:
> 
>> It's reproduceable for me by amending the commit.
> 
> Reliably reproducible?  Can you build with "-O0 -g" and run
> "commit --amend" under gdb?
> 

make NO_CURL=1 CFLAGS='-O0 -g' Done.

I also moved xmmap into commit.c, and turned the inlined definition in git-compat-util.h into a declaration.

I set a breakpoint on xmmap(). This is the backtrace on the last entry into xmmap() before it die()'ed.

The fstat message at the end is from a call to fstat that I added to print out the file size (to compare with mmap length). As you can see the fstat also fails with the 'Bad file descriptor' message.

#0  xmmap (start=0x0, length=996168, prot=1, flags=2, fd=6, offset=0)
    at commit.c:680
#1  0x080acf30 in use_pack (p=0x8150650, w_cursor=0xffffc0ac, offset=94828, 
    left=0xffffc06c) at sha1_file.c:748
#2  0x080ae169 in unpack_object_header (p=0x8150650, w_curs=0xffffc0ac, 
    curpos=0xffffc0a0, sizep=0xffffc1d0) at sha1_file.c:1333
#3  0x080ae8bb in unpack_entry (p=0x8150650, obj_offset=94828, 
    type=0xffffc1dc, sizep=0xffffc1d0) at sha1_file.c:1595
#4  0x080ae55d in cache_or_unpack_entry (p=0x8150650, base_offset=94828, 
    base_size=0xffffc1d0, type=0xffffc1dc, keep_cache=1) at sha1_file.c:1490
#5  0x080af057 in read_packed_sha1 (
    sha1=0xffffc1b0 "��\034\f~\023\203��E=�$n~��X��@�220", 
    type=0xffffc1dc, size=0xffffc1d0) at sha1_file.c:1815
#6  0x080af2cf in read_sha1_file (
    sha1=0xffffc1b0 "��\034\f~\023\203��E=�$n~��X��@�220", 
    type=0xffffc1dc, size=0xffffc1d0) at sha1_file.c:1881
#7  0x080af3a0 in read_object_with_reference (
    sha1=0x853cf18 "��\034\f~\023\203��E=�$n~��40000 libapsrs", 
    required_type_name=0x80f8488 "tree", size=0xffffc20c, 
    actual_sha1_return=0x0) at sha1_file.c:1910
#8  0x080cd2d0 in diff_tree_sha1 (
    old=0x853cf18 "��\034\f~\023\203��E=�$n~��40000 libapsrs", 
    new=0x853d108 "��\036\034_�006�\f\025\236{�220StM0�40000 libapsrs", 
    base=0x8534098 "aps/src/libapsnav/", opt=0xffffc694) at tree-diff.c:376
#9  0x080cc9cb in compare_tree_entry (t1=0xffffc330, t2=0xffffc310, 
    base=0x815a260 "aps/src/", baselen=8, opt=0xffffc694) at tree-diff.c:61
#10 0x080ccf93 in diff_tree (t1=0xffffc330, t2=0xffffc310, 
    base=0x815a260 "aps/src/", opt=0xffffc694) at tree-diff.c:278
#11 0x080cd371 in diff_tree_sha1 (
    old=0x853cbe0 "N|\021xH/K<R�\025��\2250�00644 stamp-h.in", 
    new=0x853cdb0 "\0027w���}��Ƴ\213\036±|100644 stamp-h.in", 
    base=0x815a260 "aps/src/", opt=0xffffc694) at tree-diff.c:384
---Type <return> to continue, or q <return> to quit---
#12 0x080cc9cb in compare_tree_entry (t1=0xffffc430, t2=0xffffc410, 
    base=0x817d3b8 "aps/", baselen=4, opt=0xffffc694) at tree-diff.c:61
#13 0x080ccf93 in diff_tree (t1=0xffffc430, t2=0xffffc410, 
    base=0x817d3b8 "aps/", opt=0xffffc694) at tree-diff.c:278
#14 0x080cd371 in diff_tree_sha1 (
    old=0x853c580 "\037\215��\217\200�E�b��232�03640000 avhrr", 
    new=0x853c848 "g\230\032a \207V�s~��r\177�23540000 avhrr", 
    base=0x817d3b8 "aps/", opt=0xffffc694) at tree-diff.c:384
#15 0x080cc9cb in compare_tree_entry (t1=0xffffc530, t2=0xffffc510, 
    base=0x80faba8 "", baselen=0, opt=0xffffc694) at tree-diff.c:61
#16 0x080ccf93 in diff_tree (t1=0xffffc530, t2=0xffffc510, base=0x80faba8 "", 
    opt=0xffffc694) at tree-diff.c:278
#17 0x080cd371 in diff_tree_sha1 (
    old=0x813c3dc "\231�2274M�\236�\t?�\225\t��", 
    new=0x813c43c "*!�\200\006�\235�?t��:DR", base=0x80faba8 "", 
    opt=0xffffc694) at tree-diff.c:384
#18 0x080d11d0 in log_tree_diff (opt=0xffffc610, commit=0x813c438, 
    log=0xffffc5c0) at log-tree.c:378
#19 0x080d125a in log_tree_commit (opt=0xffffc610, commit=0x813c438)
    at log-tree.c:402
#20 0x0805d26b in print_summary (prefix=0x0, 
    sha1=0xffffd7e0 "*!�\200\006�\235�?t��:DR") at builtin-commit.c:709
#21 0x0805dae7 in cmd_commit (argc=0, argv=0xffffd9e8, prefix=0x0)
    at builtin-commit.c:898
#22 0x0804b44b in run_command (p=0x80fd468, argc=3, argv=0xffffd9e8)
    at git.c:257
#23 0x0804b5f9 in handle_internal_command (argc=3, argv=0xffffd9e8)
    at git.c:383
#24 0x0804b75c in main (argc=3, argv=0xffffd9e8) at git.c:447
(gdb) c
Continuing.
fstat failed: Bad file descriptor
fatal: Out of memory? mmap failed: Bad file descriptor
Created commit 
Program exited with code 0200.
(gdb)
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 39 in “git-commit fatal: Out of memory? mmap failed: Bad file descriptor”
  1. Brandon CaseyJan 11, 2008
  2. Charles BaileyJan 11, 2008
  3. Jeff KingJan 12, 2008
  4. Marco CostalbaJan 11, 2008
  5. Brandon CaseyJan 11, 2008
  6. Junio C HamanoJan 11, 2008
  7. Brandon CaseyJan 12, 2008
  8. Junio C HamanoJan 12, 2008
  9. Alex RiesenJan 12, 2008
  10. Brandon CaseyJan 14, 2008
  11. Brandon CaseyJan 15, 2008
  12. Linus TorvaldsJan 15, 2008
  13. Brandon CaseyJan 15, 2008
  14. Linus TorvaldsJan 15, 2008
  15. Brandon CaseyJan 15, 2008
  16. Linus TorvaldsJan 15, 2008
  17. Brandon CaseyJan 15, 2008
  18. Kristian HøgsbergJan 15, 2008
  19. Brandon CaseyJan 15, 2008
  20. Brandon CaseyJan 15, 2008
  21. Linus TorvaldsJan 15, 2008
  22. Linus TorvaldsJan 15, 2008
  23. Junio C HamanoJan 15, 2008
  24. Junio C HamanoJan 16, 2008
  25. Brandon CaseyJan 16, 2008
  26. 1/2 Document lockfile APIJunio C Hamano, Jan 16, 2008
  27. 2/2 close_lock_file(): new function in the lockfile APIJunio C Hamano, Jan 16, 2008
  28. Linus TorvaldsJan 16, 2008
  29. Junio C HamanoJan 16, 2008
  30. Brandon CaseyJan 16, 2008
  31. Junio C HamanoJan 16, 2008
  32. Brandon CaseyJan 16, 2008
  33. Junio C HamanoJan 16, 2008
  34. Brandon CaseyJan 16, 2008
  35. Brandon CaseyJan 16, 2008
  36. Junio C HamanoJan 16, 2008
  37. Brandon CaseyJan 16, 2008
  38. Johannes SixtJan 16, 2008
  39. Junio C HamanoJan 15, 2008

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.