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

Potential bug in pack-objects.c

From
ANAlex Netkachov <alex.netkachov@gmail.com>
Date
Jan 21, 2019, 22:10 UTC
Message-ID
<CAGAu0HVeQFA_O8_hsZbzRi9X35fF3DAeUaSd993JF=NTwaZP1Q@mail.gmail.com>
Hi,

The most recent version of git crashes on gc command on my repository. I've tracked it down to the segmentation fault in pack-objects.c while running this command in the debugger: gdb --args /usr/src/git/git-pack-objects.exe --local --delta-base-offset .git/objects/pack/.tmp-14368-pack --keep-true-parents --honor-pack-keep --non-empty --all --reflog --indexed-objects --unpack-unreachable=2.weeks.ago --threads=1

It stops here:
#0  0x00007ff88b11de0e in ntdll!RtlLockHeap ()
   from C:\Windows\SYSTEM32\ntdll.dll
#1  0x00007ff88b11b7e4 in ntdll!RtlEnterCriticalSection ()
   from C:\Windows\SYSTEM32\ntdll.dll
#2  0x000000000047027c in oe_get_size_slow (pack=0x73fc20 <to_pack>,
    e=0x7ff5f7b03428) at builtin/pack-objects.c:1996
#3  0x000000000046ba27 in oe_set_size (pack=0x73fc20 <to_pack>,
    e=0x7ff5f7b03428, size=2987958784) at ./pack-objects.h:362
#4  0x000000000046f556 in check_object (entry=0x7ff5f7b03428)
    at builtin/pack-objects.c:1564
#5  0x000000000046ff63 in get_object_details () at builtin/pack-objects.c:1873
#6  0x0000000000471c11 in prepare_pack (window=10, depth=50)
    at builtin/pack-objects.c:2615
#7  0x0000000000474705 in cmd_pack_objects (argc=0, argv=0x2e30a48,
    prefix=0x0) at builtin/pack-objects.c:3491
#8  0x0000000000402e3b in run_builtin (p=0x680700 <commands+1728>, argc=12,
    argv=0x2e30a48) at git.c:421
#9  0x00000000004031f6 in handle_builtin (argc=12, argv=0x2e30a48)
    at git.c:653
#10 0x000000000040376b in cmd_main (argc=12, argv=0x2e30a48) at git.c:799
#11 0x00000000004bfb2f in main (argc=12, argv=0x2e30a48) at common-main.c:45

On the location builtin/pack-objects.c:1996 the code tries to set read_lock (pthread_mutex_lock(&read_mutex)) and fails. I suspect that read_mutex is not initialised yet. It is initialised in init_threaded_search, which is called later in prepare_pack (through ll_find_deltas).

Kind Regards, Alex Netkachov

Next: Jeff King
Message 1 of 3 in “Potential bug in pack-objects.c”
  1. Alex NetkachovJan 21, 2019
  2. Jeff KingJan 22, 2019
  3. Alex NetkachovJan 22, 2019

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.