mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
memleak: don't get stuck if per-peer daemons die.
Instead, continue with the next phase. I would guess this is the cause of timeouts under Travis. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
8fb1b609ce
commit
d9d762170a
2 changed files with 25 additions and 1 deletions
|
@ -863,6 +863,13 @@ AUTODATA(json_command, &fund_channel_command);
|
||||||
/* Indented to avoid include ordering check */
|
/* Indented to avoid include ordering check */
|
||||||
#include <lightningd/memdump.h>
|
#include <lightningd/memdump.h>
|
||||||
|
|
||||||
|
static void opening_died_forget_memleak(struct subd *openingd,
|
||||||
|
struct command *cmd)
|
||||||
|
{
|
||||||
|
/* FIXME: We ignore the remaining openingds in this case. */
|
||||||
|
opening_memleak_done(cmd, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Mutual recursion */
|
/* Mutual recursion */
|
||||||
static void opening_memleak_req_next(struct command *cmd, struct peer *prev);
|
static void opening_memleak_req_next(struct command *cmd, struct peer *prev);
|
||||||
static void opening_memleak_req_done(struct subd *openingd,
|
static void opening_memleak_req_done(struct subd *openingd,
|
||||||
|
@ -872,6 +879,7 @@ static void opening_memleak_req_done(struct subd *openingd,
|
||||||
bool found_leak;
|
bool found_leak;
|
||||||
struct uncommitted_channel *uc = openingd->channel;
|
struct uncommitted_channel *uc = openingd->channel;
|
||||||
|
|
||||||
|
tal_del_destructor2(openingd, opening_died_forget_memleak, cmd);
|
||||||
if (!fromwire_opening_dev_memleak_reply(msg, &found_leak)) {
|
if (!fromwire_opening_dev_memleak_reply(msg, &found_leak)) {
|
||||||
command_fail(cmd, LIGHTNINGD, "Bad opening_dev_memleak");
|
command_fail(cmd, LIGHTNINGD, "Bad opening_dev_memleak");
|
||||||
return;
|
return;
|
||||||
|
@ -898,11 +906,13 @@ static void opening_memleak_req_next(struct command *cmd, struct peer *prev)
|
||||||
if (prev != NULL)
|
if (prev != NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* FIXME: If openingd dies, we'll get stuck here! */
|
|
||||||
subd_req(p,
|
subd_req(p,
|
||||||
p->uncommitted_channel->openingd,
|
p->uncommitted_channel->openingd,
|
||||||
take(towire_opening_dev_memleak(NULL)),
|
take(towire_opening_dev_memleak(NULL)),
|
||||||
-1, 0, opening_memleak_req_done, cmd);
|
-1, 0, opening_memleak_req_done, cmd);
|
||||||
|
/* Just in case it dies before replying! */
|
||||||
|
tal_add_destructor2(p->uncommitted_channel->openingd,
|
||||||
|
opening_died_forget_memleak, cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
opening_memleak_done(cmd, NULL);
|
opening_memleak_done(cmd, NULL);
|
||||||
|
|
|
@ -1397,6 +1397,12 @@ static const struct json_command dev_forget_channel_command = {
|
||||||
};
|
};
|
||||||
AUTODATA(json_command, &dev_forget_channel_command);
|
AUTODATA(json_command, &dev_forget_channel_command);
|
||||||
|
|
||||||
|
static void subd_died_forget_memleak(struct subd *openingd, struct command *cmd)
|
||||||
|
{
|
||||||
|
/* FIXME: We ignore the remaining per-peer daemons in this case. */
|
||||||
|
peer_memleak_done(cmd, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Mutual recursion */
|
/* Mutual recursion */
|
||||||
static void peer_memleak_req_next(struct command *cmd, struct channel *prev);
|
static void peer_memleak_req_next(struct command *cmd, struct channel *prev);
|
||||||
static void peer_memleak_req_done(struct subd *subd, bool found_leak,
|
static void peer_memleak_req_done(struct subd *subd, bool found_leak,
|
||||||
|
@ -1416,6 +1422,7 @@ static void channeld_memleak_req_done(struct subd *channeld,
|
||||||
{
|
{
|
||||||
bool found_leak;
|
bool found_leak;
|
||||||
|
|
||||||
|
tal_del_destructor2(channeld, subd_died_forget_memleak, cmd);
|
||||||
if (!fromwire_channel_dev_memleak_reply(msg, &found_leak)) {
|
if (!fromwire_channel_dev_memleak_reply(msg, &found_leak)) {
|
||||||
command_fail(cmd, LIGHTNINGD, "Bad channel_dev_memleak");
|
command_fail(cmd, LIGHTNINGD, "Bad channel_dev_memleak");
|
||||||
return;
|
return;
|
||||||
|
@ -1429,6 +1436,7 @@ static void onchaind_memleak_req_done(struct subd *onchaind,
|
||||||
{
|
{
|
||||||
bool found_leak;
|
bool found_leak;
|
||||||
|
|
||||||
|
tal_del_destructor2(onchaind, subd_died_forget_memleak, cmd);
|
||||||
if (!fromwire_onchain_dev_memleak_reply(msg, &found_leak)) {
|
if (!fromwire_onchain_dev_memleak_reply(msg, &found_leak)) {
|
||||||
command_fail(cmd, LIGHTNINGD, "Bad onchain_dev_memleak");
|
command_fail(cmd, LIGHTNINGD, "Bad onchain_dev_memleak");
|
||||||
return;
|
return;
|
||||||
|
@ -1460,12 +1468,18 @@ static void peer_memleak_req_next(struct command *cmd, struct channel *prev)
|
||||||
subd_req(c, c->owner,
|
subd_req(c, c->owner,
|
||||||
take(towire_channel_dev_memleak(NULL)),
|
take(towire_channel_dev_memleak(NULL)),
|
||||||
-1, 0, channeld_memleak_req_done, cmd);
|
-1, 0, channeld_memleak_req_done, cmd);
|
||||||
|
tal_add_destructor2(c->owner,
|
||||||
|
subd_died_forget_memleak,
|
||||||
|
cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (streq(c->owner->name, "lightning_onchaind")) {
|
if (streq(c->owner->name, "lightning_onchaind")) {
|
||||||
subd_req(c, c->owner,
|
subd_req(c, c->owner,
|
||||||
take(towire_onchain_dev_memleak(NULL)),
|
take(towire_onchain_dev_memleak(NULL)),
|
||||||
-1, 0, onchaind_memleak_req_done, cmd);
|
-1, 0, onchaind_memleak_req_done, cmd);
|
||||||
|
tal_add_destructor2(c->owner,
|
||||||
|
subd_died_forget_memleak,
|
||||||
|
cmd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue