cln/lightningd
Rusty Russell edb386558c lightningd: avoid high memory usage spike at startup.
I saw this while watching top, and tracked it down.  We load all the
plugins to checksum them at startup:

```
$ ms_print massif.out.3312805 | head -n 50
--------------------------------------------------------------------------------
Command:            lightningd/lightningd.real --developer --log-level=trace --cltv-delta=6 --cltv-final=5 --watchtime-blocks=5 --rescan=1 --disable-dns --lightning-dir=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/ --addr=127.0.0.1:46337 --allow-deprecated-apis=false --network=regtest --ignore-fee-limits=false --bitcoin-rpcuser=rpcuser --bitcoin-rpcpassword=rpcpass --bitcoin-datadir=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/ --dev-fast-gossip --dev-bitcoind-poll=1 --log-file=- --log-file=/tmp/ltests-roazlc8h/test_xpay_fake_channeld_1/lightning-1/log --log-prefix=lightningd-1  --dev-fail-on-subdaemon-fail --dev-no-reconnect --autoconnect-seeker-peers=0 --subdaemon=channeld:../tests/plugins/channeld_fakenet --dev-throttle-gossip --grpc-port=37819 --dev-crash-after=3600 --bitcoin-rpcport=51623
Massif arguments:   (none)
ms_print arguments: massif.out.3312805
--------------------------------------------------------------------------------

    MB
446.5^#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#
     |#    :: : ::@@:@:::::::::::::::::::::::::::@@::::::::::::::@::::@:::::::
   0 +----------------------------------------------------------------------->Gi
     0                                                                   75.66

Number of snapshots: 57
 Detailed snapshots: [1 (peak), 2, 10, 12, 33, 45, 49]

--------------------------------------------------------------------------------
  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
--------------------------------------------------------------------------------
  0              0                0                0             0            0
  1    295,677,530      468,189,872      447,087,069    21,102,803            0
95.49% (447,087,069B) (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
->95.35% (446,440,727B) 0x2EFB99: tal_resize_ (tal.c:755)
| ->94.23% (441,180,860B) 0x2EBCD1: grab_fd (grab_file.c:45)
| | ->94.23% (441,180,860B) 0x2EBD54: grab_file (grab_file.c:63)
| |   ->94.23% (441,180,860B) 0x1A5CF7: file_checksum (plugin.c:315)
| |     ->94.23% (441,180,860B) 0x1A5EF1: plugin_register (plugin.c:355)
| |       ->94.23% (441,180,860B) 0x1AC62E: plugins_set_builtin_plugins_dir (plugin.c:2532)
| |         ->94.23% (441,180,860B) 0x16D614: find_subdaemons_and_plugins (lightningd.c:569)
| |           ->94.23% (441,180,860B) 0x16E9A1: main (lightningd.c:1226)
| |
| ->01.11% (5,219,417B) 0x2EBC32: grab_fd (grab_file.c:38)
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-03-24 13:59:58 +10:30
..
test plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
.gitignore Ignore all the deamon inside the git history 2021-10-28 15:51:38 +02:00
anchorspend.c lightningd: --dev-low-prio-anchor-blocks and test for low-priority anchors. 2024-11-26 14:49:36 +10:30
anchorspend.h channeld: use anchors on peer's commitment(s) if we can't broadcast our own. 2023-10-27 11:19:56 +10:30
bitcoind.c plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
bitcoind.h lightningd: pass explicit context for bitcoind request functions. 2024-06-24 17:26:11 +09:30
chaintopology.c ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
chaintopology.h ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
channel.c scb_wire: Define new subtype 'modern_scb_chan' with 'scb_tlvs' 2025-02-22 11:51:54 -06:00
channel.h scb_wire: Define new subtype 'modern_scb_chan' with 'scb_tlvs' 2025-02-22 11:51:54 -06:00
channel_control.c opening: Do not forget a zeroconf channel we own funds in 2025-03-19 17:32:26 +01:00
channel_control.h common: No longer support new channels without option_static_remotekey. 2024-06-19 15:54:24 +09:30
channel_gossip.c BOLTs: Add typo fixes and clarifications from "More clarifications around channel_announcement handling (#1220)" 2025-03-18 14:30:58 +10:30
channel_gossip.h lightingd: corrections from Alex Myers's review. 2024-01-31 14:47:33 +10:30
channel_state.h lightningd: rename state_change_entry to channel_state_change, and use pointers. 2024-09-21 06:20:18 +09:30
closed_channel.c common/amount: rename amount_sat_zero/amount_msat_zerp -> amount_sat_is_zero/amount_msat_is_zero. 2024-09-19 12:16:53 +09:30
closed_channel.h lightningd: add last_stable_connection field to db, channel. 2024-01-31 14:47:33 +10:30
closing_control.c common: implement op_return test. 2025-03-18 14:30:58 +10:30
closing_control.h lightningd: make close_txs parameter to resolve_close_command const. 2024-11-25 20:23:21 +10:30
coin_mvts.c lightningd: store our id as a struct pubkey as well as struct node_id. 2024-07-23 09:54:47 +09:30
coin_mvts.h coin_mvt: tiny, dont import lightningd header 2022-02-07 13:02:09 +10:30
configs.c lightningd: remove old listconfigs output. 2025-03-12 09:26:08 +10:30
connect_control.c lightningd: don't kill onchaind if we are forcing a disconnect. 2025-02-10 19:19:12 -06:00
connect_control.h connectd: reconnect for non-transient connections. 2024-11-25 15:39:13 +10:30
datastore.c lightningd: fix overzealous memleak detection in json_add_datastore. 2024-12-20 15:36:07 +10:30
dual_open_control.c common: implement op_return test. 2025-03-18 14:30:58 +10:30
dual_open_control.h common: BOLT update: option_anchors_zero_fee_htlc_tx is now simply "option_anchors". 2024-06-19 15:54:24 +09:30
feerate.c lightnind: remove deprecated feerate names. 2024-03-25 15:02:35 +10:30
feerate.h lightningd: clean up feerate handling, deprecate old terms. 2023-04-10 07:31:12 +09:30
forwards.c lightningd: listforwards returns 0 for missing received_time. ([#7157]) 2024-10-26 09:51:20 +02:00
forwards.h lightningd: clean up notification infrastructure. 2024-01-26 10:30:22 +10:30
gossip_control.c gossipd: don't tell connectd what address to connect to. 2024-11-25 15:39:13 +10:30
gossip_control.h lightningd: ignore gossip messages from channeld, switch to our own. 2024-01-31 14:47:33 +10:30
gossip_generation.c lightningd: store our id as a struct pubkey as well as struct node_id. 2024-07-23 09:54:47 +09:30
gossip_generation.h bitcoin/short_channel_id: pass by copy everywhere. 2024-03-20 13:51:48 +10:30
hsm_control.c splice: Update messages to spec 2024-11-21 14:15:36 +10:30
hsm_control.h hsmd: rename "capabilities" flags for hsm fds to "permissions" 2023-08-08 14:31:47 +09:30
htlc_end.c global: rename blinding to path_key everywhere. 2024-10-16 07:14:32 +10:30
htlc_end.h ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
htlc_set.c lightningd: generalize htlc_set. 2024-10-27 13:57:50 +11:00
htlc_set.h ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
invoice.c plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
invoice.h sendpays: hook into the wait subsystem. 2023-10-28 15:48:26 +10:30
io_loop_with_timers.c database: pull out database code into a new module 2022-03-05 15:03:34 +10:30
io_loop_with_timers.h lightningd/io_loop_with_timers.c: Move mainloop to its own source file, have chaintopology use it. 2019-05-31 17:57:10 +02:00
jsonrpc.c plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
jsonrpc.h plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
lightningd.c lightningd: remove announce-addr-dns flag. 2025-03-12 09:26:08 +10:30
lightningd.h lightningd: remove announce-addr-dns flag. 2025-03-12 09:26:08 +10:30
log.c ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
log.h common: don't send trace messages by default, don't ratelimit at all. 2024-12-16 09:48:51 +10:30
log_status.c lightningd/log: clean up nomenclature. 2023-07-19 19:13:57 +09:30
log_status.h lightningd/log: clean up nomenclature. 2023-07-19 19:13:57 +09:30
Makefile common/bolt12_id: new common routine for creating path secrets. 2024-08-01 12:31:48 +09:30
memdump.c wallet: do proper memleak scan of outpoint htables, not notleak(). 2025-01-21 09:18:25 +10:30
memdump.h lightningd: simplify memleak code. 2022-03-10 09:40:09 +10:30
notification.c lightningd: disable old notification fields. 2025-03-12 09:26:08 +10:30
notification.h new notifications: plugin_stopped and plugin_started 2025-02-12 12:54:10 +10:30
offer.c BOLT12: remove -offers from bolt12 quotes, update them. 2025-02-11 20:19:01 -06:00
onchain_control.c lightningd: fix crash in onchaind replay. 2025-03-02 16:06:34 -06:00
onchain_control.h onchaind: remove 'is_replay' logic 2021-12-28 04:42:42 +10:30
onion_message.c lightningd: fix use of deprecation macro. 2025-03-12 09:26:08 +10:30
onion_message.h common: remove support for pre v0.10.2 onionmessages. 2021-12-01 05:44:28 +10:30
opening_common.c BOLT: update to include 2016 for max_htlc_cltv. 2024-05-09 16:14:23 -05:00
opening_common.h lightningd: pass disconnect flag to subd's errcb. 2023-10-23 15:48:50 +10:30
opening_control.c lightningd: Modify stub_chan() to accomodate new fields 2025-02-22 11:51:54 -06:00
opening_control.h common: BOLT update: option_anchors_zero_fee_htlc_tx is now simply "option_anchors". 2024-06-19 15:54:24 +09:30
options.c BOLTs: Update to version with peer storage merged. 2025-03-18 14:30:58 +10:30
options.h lightningd: remove old listconfigs output. 2025-03-12 09:26:08 +10:30
pay.c lightningd: injectpaymentonion can use scids of unannounced channels. 2024-12-17 15:59:30 +10:30
pay.h lightningd: refactor payment failed. 2024-10-27 13:57:50 +11:00
peer_control.c lightningd: fix overzealous memleak report. 2025-03-24 13:59:58 +10:30
peer_control.h lightningd: create helper routine to make socketpair for a channel. 2025-02-26 10:22:03 -06:00
peer_fd.c subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
peer_fd.h lightningd: create helper routine to make socketpair for a channel. 2025-02-26 10:22:03 -06:00
peer_htlcs.c lightningd: send errors inside blinded paths correctly. 2024-11-20 12:29:27 +01:00
peer_htlcs.h lightningd: new command injectpaymentonion. 2024-10-27 13:57:50 +11:00
ping.c rpc: Removing description from json_command struct 2024-07-31 14:42:58 +09:30
plugin.c lightningd: avoid high memory usage spike at startup. 2025-03-24 13:59:58 +10:30
plugin.h plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
plugin_control.c lightningd: allow builtin plugins to be stopped. 2024-11-18 11:03:26 +10:30
plugin_control.h plugins: add command field to subcommand output. 2021-06-25 09:49:33 +09:30
plugin_hook.c plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
plugin_hook.h plugin: wire JSON id for commands which caused hooks to fire. 2022-09-16 12:31:45 +09:30
routehint.c common/amount: rename amount_sat_zero/amount_msat_zerp -> amount_sat_is_zero/amount_msat_is_zero. 2024-09-19 12:16:53 +09:30
routehint.h invoice: overhaul routehints to use topology.listincoming, cleanup. 2021-06-16 10:29:17 +09:30
runes.c lightningd: implement unblacklist. 2025-02-05 16:43:09 -06:00
runes.h runes: ensure that uniqueid is a valid number. 2023-09-12 15:19:02 +09:30
signmessage.c plugins: all plugins must now support non-numeric JSON RPC id fields. 2025-03-12 09:26:08 +10:30
subd.c common: don't send trace messages by default, don't ratelimit at all. 2024-12-16 09:48:51 +10:30
subd.h lightningd: allow subd_req() to take replycb_data arg. 2024-11-13 14:44:03 +10:30
wait.c rpc: Removing description from json_command struct 2024-07-31 14:42:58 +09:30
wait.h lightningd: hook forwards into the wait system. 2023-10-28 15:48:26 +10:30
watch.c ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
watch.h ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30