lightningd: fix transient leak report when openingd shutting down.

```
>           raiseValueError(str(errors))
E           ValueError: 
E           Node errors:
E           Global errors:
E            - Node /tmp/ltests-x5sfpiwp/test_openchannel_hook_chaining_1/lightning-2/ has memory leaks: [
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "ccan/ccan/io/io.c:91 (io_new_conn_)",
E                       "lightningd/subd.c:773 (new_subd)",
E                       "lightningd/subd.c:827 (new_channel_subd_)",
E                       "lightningd/opening_control.c:870 (peer_start_openingd)",
E                       "lightningd/peer_control.c:1307 (peer_active)",
E                       "lightningd/connect_control.c:457 (connectd_msg)",
E                       "lightningd/subd.c:556 (sd_msg_read)",
E                       "lightningd/subd.c:357 (read_fds)",
E                       "ccan/ccan/io/io.c:59 (next_plan)",
E                       "ccan/ccan/io/io.c:407 (do_plan)",
E                       "ccan/ccan/io/io.c:417 (io_ready)",
E                       "ccan/ccan/io/poll.c:453 (io_loop)",
E                       "lightningd/io_loop_with_timers.c:22 (io_loop_with_timers)",
E                       "lightningd/lightningd.c:1181 (main)",
E                       "../csu/libc-start.c:308 (__libc_start_main)"
E                   ],
E                   "label": "ccan/ccan/io/io.c:91:struct io_conn",
E                   "parents": [
E                       "lightningd/lightningd.c:107:struct lightningd"
E                   ],
E                   "value": "0x2b5a898"
E               }
E           ]
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-06-26 14:18:01 +09:30
parent fcff21fae5
commit 70b091d9f6
1 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include <common/json_command.h> #include <common/json_command.h>
#include <common/json_helpers.h> #include <common/json_helpers.h>
#include <common/json_tok.h> #include <common/json_tok.h>
#include <common/memleak.h>
#include <common/param.h> #include <common/param.h>
#include <common/type_to_string.h> #include <common/type_to_string.h>
#include <connectd/connectd_wiregen.h> #include <connectd/connectd_wiregen.h>
@ -675,7 +676,8 @@ openchannel_hook_final(struct openchannel_hook_payload *payload STEALS)
} else } else
upfront_shutdown_script_wallet_index = NULL; upfront_shutdown_script_wallet_index = NULL;
/* In case peer goes away right now, mark openingd notleak() */
notleak(openingd);
subd_send_msg(openingd, subd_send_msg(openingd,
take(towire_openingd_got_offer_reply(NULL, errmsg, take(towire_openingd_got_offer_reply(NULL, errmsg,
our_upfront_shutdown_script, our_upfront_shutdown_script,