threads / bug / 50278

Potential bug in pack-objects.c

Subject: Potential bug in pack-objects.c

## tl;dr

3 messages between Jan 21, 2019 and Jan 22, 2019.

replies: 2people: 2as markdown or json

Alex Netkachov· Jan 21, 2019, 22:10 UTC · lore
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

Jeff King· Jan 22, 2019, 07:29 UTC · re: Alex Netkachov · lore

Re: Potential bug in pack-objects.c

On Mon, Jan 21, 2019 at 10:10:16PM +0000, Alex Netkachov wrote:
Show 5 quoted lines
> 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).
This sounds like the same bug being discussed in:
  http://public-inbox.org/git/20190118022736.36832-1-phogg@novamoon.net/
-Peff
Alex Netkachov· Jan 22, 2019, 15:33 UTC · re: Jeff King · lore

Re: Potential bug in pack-objects.c

On Tue, 22 Jan 2019 at 07:29, Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
>
> On Mon, Jan 21, 2019 at 10:10:16PM +0000, Alex Netkachov wrote:
>
> > 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).
>
> This sounds like the same bug being discussed in:
>
>   http://public-inbox.org/git/20190118022736.36832-1-phogg@novamoon.net/

It is exactly the same thing. Thank you. Hope it will be applied soon and released.

Kind regards, Alex

← back to recent threads