Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memleak hook: find leaks in plugins #4737

Merged
merged 20 commits into from
Sep 8, 2021

Commits on Sep 6, 2021

  1. ccan: update to get version where tal_dump goes to stderr.

    This is useful for plugins which can't send junk to stdout.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    089a79e View commit details
    Browse the repository at this point in the history
  2. common/memleak: take over dump_memleak(), allow print pointer.

    This will let plugins use it.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    21015b6 View commit details
    Browse the repository at this point in the history
  3. common/memleak: hoist strmap helper from out of lightningd/memdump.c

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    2cc059b View commit details
    Browse the repository at this point in the history
  4. libplugin: allow stealing of feature sets, make keysend do that.

    Otherwise the NULL parents look like a memleak.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    2eef60d View commit details
    Browse the repository at this point in the history
  5. libplugin: allow take() for commands, notif_subs, hook_subs, notif_to…

    …pics.
    
    Useful for plugins which dynamically generate them.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    0e6ba57 View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. libplugin: if DEVELOPER set, do memleak detection on shutdown.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    93521f4 View commit details
    Browse the repository at this point in the history
  2. libplugin: let plugins add annotations to memleak.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    mar
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    d1aa052 View commit details
    Browse the repository at this point in the history
  3. plugins/bcli: handle memleak.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    024a40f View commit details
    Browse the repository at this point in the history
  4. plugins/funder: don't use global owner parent; mark policy for memleak.

    And free the err string when policy turns out not to be a u64.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    a1953e2 View commit details
    Browse the repository at this point in the history
  5. spender/openchannel.c: don't leave psbt parts owned by NULL.

    They get grafted into clone, so have them parented there.  Otherwise
    we get a small leak every time we RBF.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    a5a7dfb View commit details
    Browse the repository at this point in the history
  6. plugins/spender: don't use global tal context, use take() instead.

    Otherwise it looks like a leak.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    ca4ea96 View commit details
    Browse the repository at this point in the history
  7. plugins/bcli: keep a list of current bitcoind requests.

    This lets memleak track them, but makes sure they don't leak; using
    notleak could cover up a leak here.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    26a9203 View commit details
    Browse the repository at this point in the history
  8. plugins/txprepare: annotate unreleased_txs list against false memleaks.

    And fix utx leak in the withdraw case.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    2055f10 View commit details
    Browse the repository at this point in the history
  9. wire/tlvstream: don't leak in tlvstream_set_tu64/tu32/short_channel_id.

    Another tiny leak, which happened in keysend which uses these routines.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    b1ddb17 View commit details
    Browse the repository at this point in the history
  10. pytest: annotate name_option against leak detection in test_libplugin

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    a6846bb View commit details
    Browse the repository at this point in the history
  11. plugins/topology: use memleak annotation instead of global_gossmap ha…

    …mmer.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    6db2fc0 View commit details
    Browse the repository at this point in the history
  12. libplugin: fix leak of struct command when we don't read it all at once.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Changelog-Fixed: Plugins: C plugins would could leak memory on every command (esp. seen when hammering topology's listchannels).
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    465cd85 View commit details
    Browse the repository at this point in the history
  13. plugins/libplugin: mark timers as not-a-leak.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    21e322e View commit details
    Browse the repository at this point in the history
  14. libplugin: make leaks log at LOG_BROKEN so they break CI.

    Now we've fixed them, this makes sure CI notices if new leaks appear.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    2d60cbe View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2021

  1. lightningd/chaintopology: stop callbacks rearming once topology stopped.

    Otherwise we get very upset when the plugins go away.
    
    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    rustyrussell committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    9315cee View commit details
    Browse the repository at this point in the history