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)