myxce/.wolf/bugs/bug-1918.md
Rongsong Shen acf78f9a94
docs(buglog): bug-1913 and bug-1916 fixed; log bug-1915, bug-1917, bug-1918
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-03 23:18:53 +00:00

2.1 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related
bug-1918 open 2026-10-03 newly logged lib leak 2026-10-03T23:04:08Z 2026-10-03T23:04:08Z 1
src/lib/xcectx.c
src/lib/vtaskmgr.c
src/controller/cluster.c
leak
vtask
netio
bug-1916

bug-1918: handle_msg / vtask_handle_msg early -EINVAL/-ENOMEM exits leak the received packet

Description

Observed: Not yet observed at runtime -- found reviewing the bug-1916 fix. When handle_msg (src/lib/xcectx.c ~196-198, src/controller/cluster.c ~1371-1373) or vtask_handle_msg (src/lib/vtaskmgr.c ~617-629) returns early with -EINVAL/-ENOMEM, the received packet is still in ep->fsm_in.pkt; INVOKE_MSG_HANDLER (src/include/netio.h:148-158) then stores NULL into the slot without freeing it, so the packet leaks.

Expected: on every early exit the packet is freed exactly once (either the handler frees it, or the slot keeps it and the endpoint teardown frees it). Impact: small per-message leak on rare error paths (allocation failure, missing context); pre-existing, not a crash. Found by: review (bug-1916 fix, 2026-10-03)

Environment

  • OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
  • libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2)
  • Toolchain: gcc (GCC) 15.2.0, meson 1.9.1
  • Build: asan (xce.build)
  • Code: scheduler-framework @ 6d9ef3d0-dirty
  • Deployment: any libxce client or the controller's client-request path

Reproduction

  1. Not reproduced; force vtask_handle_msg to fail (e.g. allocation failure via a test hook) and check LeakSanitizer for the packet.
  • Frequency: 0/1 runs, 2026-10-03 (code-review finding)
  • Evidence: code reading of the cited lines

Root cause

TODO: required for fixed/partial

Fix

TODO: required for fixed/partial

Verification

  • Test: TODO: name + file; RED before the fix, GREEN after
  • Suites: TODO: suite results and build profile
  • Live: TODO: soak/deploy run, or n/a and why

References

  • Related: none