chore(buglog): harness batch fixed (da1a663f): bug-1574/1702/1703/1705/1707-1710/1712/1777/1793/1796/1797

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-28 04:17:31 +00:00
parent da1a663f05
commit 8cadeeb2d0
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
14 changed files with 221 additions and 156 deletions

View file

@ -1,16 +1,17 @@
---
id: "bug-1797"
status: "open"
status_updated: "2026-09-24"
status_note: "cmd_qctrl leaks strdup'd queue name on RPC error (src/harness/test.c)"
status: "fixed"
status_updated: "2026-09-28"
status_note: ""
component: "controller"
severity: "leak"
timestamp: "2026-09-09T22:00:00Z"
last_seen: "2026-09-19T09:00:00Z"
occurrences: 3
files: ["src/controller/testsuite/test.c (cmd_qctrl)"]
files: ["src/harness/test.c"]
tags: ["controller", "testsuite", "xce_test", "cmd_qctrl", "leak", "asan", "xce-test-cli-ux", "task-4.2", "pre-existing", "deferred"]
related: ["bug-1796"]
fix_commits: ["da1a663f"]
legacy: true
---
@ -29,10 +30,12 @@ _Not recorded (migrated from buglog.json)._
cmd_qctrl does `queue = strdup(optarg)` while parsing -q, then on `if (rc < 0) { perror("xcecli_queuectrl"); return rc; }` (the RPC-error branch) returns without `free(queue)` -- only the success path frees it. Distinct from the adjacent, intentional non-free on the EINTR/abandoned-worker path (ownership legitimately transferred there per the interruptible-call adapter's contract). Found during xce-test-cli-ux task 4.2's live confirmation-gate verification (a bypassed qctrl against a bogus queue name triggered this exact RPC-error branch under the asan build). Confirmed pre-existing (commit 41f56fa6e, 2025-11-05), predating the whole xce-test-cli-ux spec and untouched by task 3.1's flagspec migration; not caused by any change in this spec.
## Fix
NOT YET FIXED (found and deliberately deferred -- out of boundary for task 4.2, a pure live-verification task with no source changes permitted). Recommended: add `free(queue);` on the RPC-error return path (or restructure with a single cleanup label), and check `cmd_hostctrl`/`cmd_jobkill`'s sibling strdup'd-argument fields for the same pattern.
cmd_qctrl frees the queue name on the RPC-error path and when the call allocation fails, and a repeated -q frees the earlier copy (hostctrl's -h likewise). The interrupted-call path still hands the name to the worker thread, as before.
## Verification
_Not recorded (migrated from buglog.json)._
- Test: LeakSanitizer run of the fixed xce_test (`qctrl -q bogus -a` with no controller, ASAN_OPTIONS=detect_leaks=1): no leak with a cmd_qctrl frame; an automated test is not practical because the harness suites run with detect_leaks=0 and xce_test leaks elsewhere at exit
- Suites: harness 6/6 (asan): harness_unit_test 141/0, cmdutil 14/0, resval_typeresolve 7/0, joblist_display 22/0, join_worker_args 7/0, listrow_json 12/0
- Live: n/a; xce_test is a client tool and every case above runs without a controller
## References
- Related: bug-1796