myxce/.wolf/bugs/bug-1723.md
Rongsong Shen d26ff8870d
feat(buglog): one Markdown record per bug, checked against a record standard
The buglog was one 27K-line JSON file whose fields covered only symptom,
root cause and fix, as free text: 2% of entries named the code version a
bug was found on, 12% the build profile, 36% a way to reproduce, and 58% of
the file was OpenWolf hook auto-detections ("Missing guard clause",
"Function not marked async" on .md files).

- .claude/skills/buglog/bug-record.md: the record standard. Eight
  sections (Summary as the title, Description, Environment, Reproduction;
  Root cause, Fix, Verification, References once fixed), each with the
  content it must contain -- e.g. Environment needs the OS, the libc the
  failing binary loads (from its ELF interpreter: glibc 2.42 in the nix
  shell vs 2.40 on the host), toolchain, build profile and commit.
- .wolf/bugs/<id>.md: 500 records migrated from buglog.json; every field
  verified to round-trip. They carry legacy: true and an explicit "not
  recorded" where the old log had no such field; component derived from
  file paths, severity from keywords (else unknown), fix_commits from
  hashes in status_note/fix that git resolves (91 of 463 fixed).
- .wolf/buglog-archive.json: the 710 hook auto-detections, verbatim.
- .wolf/buglog.json is now an index generated from the records, keeping
  the fields OpenWolf's hooks and `openwolf bug search` read.
- scripts/buglog.py rewritten: new (template + Environment collected from
  the machine and --binary), check, status (refuses a status the record
  doesn't support; fixed needs Root cause, Fix, Verification and
  --commit hashes git resolves), note, recur, set, show, list, triage,
  env, index. 29 unittest cases in scripts/tests/test_buglog.py.
- scripts/git-hooks/pre-commit runs `check --staged`: incomplete staged
  records, a legacy record hand-changed to fixed without the fix-time
  sections, a new record claiming legacy: true, or a stale index refuse
  the commit.
- scripts/gitea-sync.py reads the records: issue body = the record's
  sections plus linked fix commits (origin remote, GITEA_COMMIT_REPO to
  override), and a body hash so an issue's text is refreshed when the
  record changes.
- bug-1866 rewritten to the full standard as the worked example.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 03:40:11 +00:00

38 lines
3.2 KiB
Markdown

---
id: "bug-1723"
status: "fixed"
status_updated: "2026-09-24"
status_note: ""
component: "lib"
severity: "crash"
timestamp: "2026-08-27T00:00:00Z"
last_seen: "2026-09-19T09:00:00Z"
occurrences: 1
files: ["src/lib/testsuite/test_xcealloc.c"]
tags: ["memory-leak", "asan", "leaksanitizer", "xcealloc", "test-fixture-teardown", "scheduler-snapshot-job-allocation", "pre-existing", "out-of-scope"]
related: ["bug-1722", "bug-1621", "bug-1437"]
legacy: true
---
# bug-1723: LeakSanitizer (xcelib_test's ASAN default detect_leaks=1, per bug-1437's established precedent…
## Description
LeakSanitizer (xcelib_test's ASAN default detect_leaks=1, per bug-1437's established precedent that this is a separate pass/fail axis from Unity PASS/FAIL) aborts the whole xcelib_test binary at exit with SIGABRT even on a completely clean run (all Unity tests, including the new scheduler-snapshot-job-allocation task 1.1 dup_job_alloc() suite, report 0 Failures) -- 456 byte(s) leaked in 29 allocation(s), confirmed present identically at HEAD before task 1.1's changes (baseline A/B comparison: stashed task 1.1's 3 changed files, rebuilt, reran standalone binary -- same 456 bytes/29 allocations, same two leak sources, same SIGABRT).
## Environment
_Not recorded (migrated from buglog.json)._
## Reproduction
_Not recorded (migrated from buglog.json)._
## Root cause
test_make_job_account_multi_host_no_overflow() (added in bug-1722's fix) calls free_job_account(account) but never frees its own directly-built fixture tree (jalloc/hallocs/h0/h1/a0/a1 -- make_job_alloc()'s calloc at xcealloc.c:156 and the two make_alloc()-internal strdup()s it roots). test_make_host_allocs_multi_host_no_overflow() (same commit) frees nothing at all (make_host_allocs()'s calloc at xcealloc.c:134 and its two hosts/allocs). Neither test calls free_JobAlloc_ptr() or any other teardown on its own locally-constructed xce_job_alloc_t/xce_host_alloc_t** tree. Pre-existing since bug-1722's commit (00207503), not introduced by task 1.1 -- confirmed via git-stash A/B rebuild showing byte-for-byte identical leak signature with task 1.1's 3 files reverted.
## Fix
FIXED (2026-09-08, follow-up session). Applied exactly the fix this entry already specified: added free_JobAlloc_ptr(&jalloc); at the end of test_make_job_account_multi_host_no_overflow() (frees jalloc/hallocs/h0/h1/a0/a1's whole tree, after free_job_account(account) already frees the account side) and free_HostAlloc_list(2, hallocs); at the end of test_make_host_allocs_multi_host_no_overflow() (which previously freed nothing at all). This reduced the leak from 456 bytes/29 allocations to 12 bytes/2 allocations -- the residual was a DIFFERENT, deeper pre-existing production bug (free_host_account() never freeing acct->host), already independently logged as bug-1621 and fixed in the same pass; see that entry. Verified: standalone xcelib_test binary now 1/1 Ok with zero LeakSanitizer reports (was: SIGABRT on every run, even with all Unity tests passing); full xce-build.sh all asan --incremental: 94/94 Ok (controller/scheduler/lib/worker/apiserver C suites + all Go test packages), zero regressions.
## Verification
_Not recorded (migrated from buglog.json)._
## References
- Related: bug-1722, bug-1621, bug-1437