Re: [PATCH v2 00/21] Various memory leak fixes
- From
Patrick Steinhardt <ps@pks.im>
- Date
- May 28, 2024, 05:09 UTC
- Message-ID
- <ZlVnJm4OcPGHdC3P@tanuki>
- In-Reply-To
- <xmqqwmnf9mto.fsf@gitster.g>
On Mon, May 27, 2024 at 10:38:59AM -0700, Junio C Hamano wrote:
Show 13 quoted lines
> Patrick Steinhardt <ps@pks.im> writes: > >> Also > >> > >> https://github.com/git/git/actions/runs/9231313414/job/25401102951 > >> > >> shows that t1460-refs-migrate fails on Windows. > > > > Hm, this one is curious. There are no leak logs at all, and the exit > > code is 139. Might be SIGSEGV, indicating that something else is going > > on here than a memory leak. > > Sorry, I wasn't clear enough. I do not suspect this is about leaks > (and the failing job on Windows is not about leaks).
I figured this one out now: Windows of course refuses to remove some of the files because they are kept open. This shouldn't lead to a segfault itself. But we call `free_ref_cache()` on a partially initialized files ref store, nad that function didn't handle the case when it is being passed a `NULL` pointer.
I've addressed this by releasing the reftable ref store before trying to remove it from disk so that all files are being closed. But it also surfaced another bug: our worktree code creates a copy of the main ref store by accident because we set up `wt->is_current` _after_ we have called `get_worktree_ref_store()`.
I fixed all of this and will send a new version in a bit.
Patrick