Skip to content

connectd: free individual listeners on shutdown - #64

Merged
kwsantiago merged 1 commit into
blake2b-unifiedfrom
connectd-free-listeners
Oct 21, 2026
Merged

kwsantiago merged 1 commit into
blake2b-unifiedfrom
connectd-free-listeners

Conversation

@kwsantiago

Copy link
Copy Markdown

Backports the upstream fix that frees each connectd listener in start_shutdown(), not just the array holding them. Without it the listening sockets stay open during shutdown and the memleak check can flag them, which failed test_funding_cancel_race under ASan on #63.

Changelog-None

In start_shutdown(), freeing daemon->listeners only freed the tal
array of pointers, but not the struct io_listener objects themselves
since they are parented to daemon. This left the listening sockets open
and caused them to be flagged as memory leaks during leak detection:

    **BROKEN** connectd: MEMLEAK: 0x55b7288579f8
    **BROKEN** connectd:   label=ccan/ccan/io/io.c:25:struct io_listener
    **BROKEN** connectd:   alloc:
    **BROKEN** connectd:     ccan/ccan/io/io.c:25 (io_new_listener_)
    **BROKEN** connectd:     connectd/connectd.c:1818 (connect_activate)
    **BROKEN** connectd:     connectd/connectd.c:2357 (recv_req)
    **BROKEN** connectd:   parents:
    **BROKEN** connectd:     connectd/connectd.c:2519:struct daemon

Explicitly tal_free each listener in daemon->listeners before freeing the
array.

Changelog-None

(cherry picked from commit 862c46b)
@kwsantiago
kwsantiago merged commit e48ea5b into blake2b-unified Oct 21, 2026
89 of 91 checks passed
@kwsantiago
kwsantiago deleted the connectd-free-listeners branch October 21, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants