Skip to content

Potential memory leak in wallet_clean_utxos #3780

Description

@cdecker

The following potential error was detected by CI (could be a false positive due to a pending RPC call being interrupted by the memleak call, in which case we need to ensure we keep a pointer):

_________________ ERROR at teardown of test_txprepare_restart __________________
[gw23] linux -- Python 3.6.8 /usr/bin/python3

request = <SubRequest 'teardown_checks' for <Function test_txprepare_restart>>

    @pytest.fixture
    def teardown_checks(request):
        """A simple fixture to collect errors during teardown.

        We need to collect the errors and raise them as the very last step in the
        fixture tree, otherwise some fixtures may not be cleaned up
        correctly. Require this fixture in all other fixtures that need to either
        cleanup before reporting an error or want to add an error that is to be
        reported.

        """
        errors = TeardownErrors()
        yield errors

        if errors.has_errors():
            # Format a nice list of everything that went wrong and raise an exception
            request.node.has_errors = True
>           raise ValueError(str(errors))
E           ValueError:
E           Node errors:
E           Global errors:
E            - Node /tmp/ltests-25ah4teu/test_txprepare_restart_1/lightning-1/ has memory leaks: [
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "wallet/wallet.c:154 (wallet_stmt2output)",
E                       "wallet/wallet.c:275 (wallet_get_utxos)",
E                       "wallet/wallet.c:3751 (wallet_clean_utxos)",
E                       "lightningd/lightningd.c:914 (main)"
E                   ],
E                   "label": "wallet/wallet.c:154:struct utxo",
E                   "parents": [
E                       "wallet/wallet.c:273:struct utxo*[]"
E                   ],
E                   "value": "0x564672eca9d8"
E               },
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "wallet/wallet.c:154 (wallet_stmt2output)",
E                       "wallet/wallet.c:275 (wallet_get_utxos)",
E                       "wallet/wallet.c:3751 (wallet_clean_utxos)",
E                       "lightningd/lightningd.c:914 (main)"
E                   ],
E                   "label": "wallet/wallet.c:154:struct utxo",
E                   "parents": [
E                       "wallet/wallet.c:273:struct utxo*[]"
E                   ],
E                   "value": "0x564672ecdb78"
E               },
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "wallet/wallet.c:154 (wallet_stmt2output)",
E                       "wallet/wallet.c:275 (wallet_get_utxos)",
E                       "wallet/wallet.c:3751 (wallet_clean_utxos)",
E                       "lightningd/lightningd.c:914 (main)"
E                   ],
E                   "label": "wallet/wallet.c:154:struct utxo",
E                   "parents": [
E                       "wallet/wallet.c:273:struct utxo*[]"
E                   ],
E                   "value": "0x564672ec0158"
E               },
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "wallet/wallet.c:154 (wallet_stmt2output)",
E                       "wallet/wallet.c:275 (wallet_get_utxos)",
E                       "wallet/wallet.c:3751 (wallet_clean_utxos)",
E                       "lightningd/lightningd.c:914 (main)"
E                   ],
E                   "label": "wallet/wallet.c:154:struct utxo",
E                   "parents": [
E                       "wallet/wallet.c:273:struct utxo*[]"
E                   ],
E                   "value": "0x564672ebdbb8"
E               },
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "wallet/wallet.c:154 (wallet_stmt2output)",
E                       "wallet/wallet.c:275 (wallet_get_utxos)",
E                       "wallet/wallet.c:3751 (wallet_clean_utxos)",
E                       "lightningd/lightningd.c:914 (main)"
E                   ],
E                   "label": "wallet/wallet.c:154:struct utxo",
E                   "parents": [
E                       "wallet/wallet.c:273:struct utxo*[]"
E                   ],
E                   "value": "0x564672eecbf8"
E               },
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "wallet/wallet.c:154 (wallet_stmt2output)",
E                       "wallet/wallet.c:275 (wallet_get_utxos)",
E                       "wallet/wallet.c:3751 (wallet_clean_utxos)",
E                       "lightningd/lightningd.c:914 (main)"
E                   ],
E                   "label": "wallet/wallet.c:154:struct utxo",
E                   "parents": [
E                       "wallet/wallet.c:273:struct utxo*[]"
E                   ],
E                   "value": "0x564672eca288"
E               }
E           ]

contrib/pyln-testing/pyln/testing/fixtures.py:171: ValueError

Activity

  1. changed the title [-]Potential memory leak[/-] [+]Potential memory leak in `wallet_clean_utxos`[/+] on Jun 19, 2020
  2. cdecker commented on Jun 29, 2020

    @cdecker
    MemberAuthor

    Since this is our on-startup cleanup it'll most likely be fixed by #3789 or replacements.

  3. cdecker commented on Jul 22, 2020

    @cdecker
    MemberAuthor

    Fixed by #3825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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