Skip to content

a less-invasive racy-leak fix

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6test-lib: use individual lsan dir for --stress runst/test-lib.sh+1 -10 replies
2/6Revert "index-pack: spawn threads atomically"builtin/index-pack.c+0 -20 replies
3/6test-lib: rely on logs to detect leakst/test-lib.sh+1 -02 replies
4/6test-lib: simplify leak-log checkingt/test-lib.sh+8 -134 replies
5/6test-lib: check leak logs for presence of DEDUP_TOKENt/test-lib.sh+1 -10 replies
6/6test-lib: ignore leaks in the sanitizer's thread codet/test-lib.sh+2 -13 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/6] a less-invasive racy-leak fix
Quoted 7 lines · Jeff King

And finally, one other option (that I'm not sure why I didn't consider before): can we just ignore the false positives, similar to what we did in 370ef7e40d (test-lib: ignore uninteresting LSan output, 2023-08-28). I think we'd have to stop doing abort_on_error for the leak checker and just rely on the logs, but that's OK (we always check the logs these days). And detecting the false positive is a little involved. But this seems to work:

So here's a clean series that does that. I'm kicking myself a little for not going this route immediately, and spending so much time trying to deal with the actual race in code that is not even ours. :-/

It would replace what's queued in jk/lsan-race-with-barrier, though the first two patches remain the same.

Since the grep exit codes and inversions are a little tricky, I checked at each step that we continue to correctly report the leaks found by doing:

t/helper/test-date.c +0 -2
index f25512de9a..7bedb51eaf 100644
@@ -54,8 +54,6 @@ static void show_dates(const char **argv, const char *format)
 
 		printf("%s -> %s\n", *argv, show_date(t, tz, mode));
 	}
-
-	date_mode_release(&mode);
 }
 
 static void parse_dates(const char **argv)

and running "./t0006-date.sh -i" (which should bail on test 23 and report the full stack trace).

[1/6]: test-lib: use individual lsan dir for --stress runs [2/6]: Revert "index-pack: spawn threads atomically" [3/6]: test-lib: rely on logs to detect leaks [4/6]: test-lib: simplify leak-log checking
[5/6]: test-lib: check leak logs for presence of DEDUP_TOKEN [6/6]: test-lib: ignore leaks in the sanitizer's thread code

 builtin/index-pack.c |  2 --
 t/test-lib.sh        | 25 +++++++++++--------------
 2 files changed, 11 insertions(+), 16 deletions(-)

-Peff