Skip to content

CI: memleak reports for watchman's response-parented blockhash strings #9362

Description

@ksedgwic

Seen on a liquid CI run:
https://github.com/ElementsProject/lightning/actions/runs/30378010987/job/90350105780

ERROR tests/test_plugin.py::test_bwatch_add_watch_creates_datastore_entry

  • lightningd-1: had memleak messages

MEMLEAK: 0x556cc3af3378
label=char[]
alloc:
bitcoin/block.c:250 (fmt_bitcoin_blkid)
lightningd/watchman.c:758 (json_block_processed)

json_add_string copies its value, so nothing references the formatted
string after the call. It is parented to the response stream and is
freed with it, but the memleak scanner searches memory for pointers to
each allocation, so a dev memleak check that lands while a
block_processed response is in flight reports the string as a leak.
json_getwatchmanheight has the same pattern. Any bwatch test can hit
this on a slow runner. Two-line fix (parent to tmpctx) in the PR.

Part of #9222.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions