mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
lighningd: Remove --debug-subdaemon-io.
We can use SIGUSR1, even in non-developer builds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -78,7 +78,6 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
|
|||||||
ld->reconnect = true;
|
ld->reconnect = true;
|
||||||
timers_init(&ld->timers, time_mono());
|
timers_init(&ld->timers, time_mono());
|
||||||
ld->topology = new_topology(ld, ld->log);
|
ld->topology = new_topology(ld, ld->log);
|
||||||
ld->debug_subdaemon_io = NULL;
|
|
||||||
ld->daemon = false;
|
ld->daemon = false;
|
||||||
ld->pidfile = NULL;
|
ld->pidfile = NULL;
|
||||||
ld->ini_autocleaninvoice_cycle = 0;
|
ld->ini_autocleaninvoice_cycle = 0;
|
||||||
|
|||||||
@@ -156,9 +156,6 @@ struct lightningd {
|
|||||||
/* PID file */
|
/* PID file */
|
||||||
char *pidfile;
|
char *pidfile;
|
||||||
|
|
||||||
/* May be useful for non-developers debugging in the field */
|
|
||||||
char *debug_subdaemon_io;
|
|
||||||
|
|
||||||
/* Initial autocleaninvoice settings. */
|
/* Initial autocleaninvoice settings. */
|
||||||
u64 ini_autocleaninvoice_cycle;
|
u64 ini_autocleaninvoice_cycle;
|
||||||
u64 ini_autocleaninvoice_expiredby;
|
u64 ini_autocleaninvoice_expiredby;
|
||||||
|
|||||||
@@ -368,9 +368,6 @@ static void config_register_opts(struct lightningd *ld)
|
|||||||
opt_set_bool_arg, opt_show_bool,
|
opt_set_bool_arg, opt_show_bool,
|
||||||
&deprecated_apis,
|
&deprecated_apis,
|
||||||
"Enable deprecated options, JSONRPC commands, fields, etc.");
|
"Enable deprecated options, JSONRPC commands, fields, etc.");
|
||||||
opt_register_arg("--debug-subdaemon-io",
|
|
||||||
opt_set_charp, NULL, &ld->debug_subdaemon_io,
|
|
||||||
"Enable full peer IO logging in subdaemons ending in this string (can also send SIGUSR1 to toggle)");
|
|
||||||
opt_register_arg("--autocleaninvoice-cycle",
|
opt_register_arg("--autocleaninvoice-cycle",
|
||||||
opt_set_u64, opt_show_u64,
|
opt_set_u64, opt_show_u64,
|
||||||
&ld->ini_autocleaninvoice_cycle,
|
&ld->ini_autocleaninvoice_cycle,
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ static void close_taken_fds(va_list *ap)
|
|||||||
/* We use sockets, not pipes, because fds are bidir. */
|
/* We use sockets, not pipes, because fds are bidir. */
|
||||||
static int subd(const char *dir, const char *name,
|
static int subd(const char *dir, const char *name,
|
||||||
const char *debug_subdaemon,
|
const char *debug_subdaemon,
|
||||||
const char *debug_subdaemon_io,
|
|
||||||
int *msgfd, int dev_disconnect_fd, va_list *ap)
|
int *msgfd, int dev_disconnect_fd, va_list *ap)
|
||||||
{
|
{
|
||||||
int childmsg[2], execfail[2];
|
int childmsg[2], execfail[2];
|
||||||
@@ -160,7 +159,7 @@ static int subd(const char *dir, const char *name,
|
|||||||
int fdnum = 3, i, stdin_is_now = STDIN_FILENO;
|
int fdnum = 3, i, stdin_is_now = STDIN_FILENO;
|
||||||
long max;
|
long max;
|
||||||
size_t num_args;
|
size_t num_args;
|
||||||
char *args[] = { NULL, NULL, NULL, NULL, NULL };
|
char *args[] = { NULL, NULL, NULL, NULL };
|
||||||
|
|
||||||
close(childmsg[0]);
|
close(childmsg[0]);
|
||||||
close(execfail[0]);
|
close(execfail[0]);
|
||||||
@@ -207,8 +206,6 @@ static int subd(const char *dir, const char *name,
|
|||||||
if (debug_subdaemon && strends(name, debug_subdaemon))
|
if (debug_subdaemon && strends(name, debug_subdaemon))
|
||||||
args[num_args++] = "--debugger";
|
args[num_args++] = "--debugger";
|
||||||
#endif
|
#endif
|
||||||
if (debug_subdaemon_io && strends(name, debug_subdaemon_io))
|
|
||||||
args[num_args++] = "--log-io";
|
|
||||||
execv(args[0], args);
|
execv(args[0], args);
|
||||||
|
|
||||||
child_errno_fail:
|
child_errno_fail:
|
||||||
@@ -261,7 +258,7 @@ int subd_raw(struct lightningd *ld, const char *name)
|
|||||||
disconnect_fd = ld->dev_disconnect_fd;
|
disconnect_fd = ld->dev_disconnect_fd;
|
||||||
#endif /* DEVELOPER */
|
#endif /* DEVELOPER */
|
||||||
|
|
||||||
pid = subd(ld->daemon_dir, name, debug_subd, ld->debug_subdaemon_io,
|
pid = subd(ld->daemon_dir, name, debug_subd,
|
||||||
&msg_fd, disconnect_fd,
|
&msg_fd, disconnect_fd,
|
||||||
NULL);
|
NULL);
|
||||||
if (pid == (pid_t)-1) {
|
if (pid == (pid_t)-1) {
|
||||||
@@ -658,7 +655,7 @@ static struct subd *new_subd(struct lightningd *ld,
|
|||||||
disconnect_fd = ld->dev_disconnect_fd;
|
disconnect_fd = ld->dev_disconnect_fd;
|
||||||
#endif /* DEVELOPER */
|
#endif /* DEVELOPER */
|
||||||
|
|
||||||
sd->pid = subd(ld->daemon_dir, name, debug_subd, ld->debug_subdaemon_io,
|
sd->pid = subd(ld->daemon_dir, name, debug_subd,
|
||||||
&msg_fd, disconnect_fd, ap);
|
&msg_fd, disconnect_fd, ap);
|
||||||
if (sd->pid == (pid_t)-1) {
|
if (sd->pid == (pid_t)-1) {
|
||||||
log_unusual(ld->log, "subd %s failed: %s",
|
log_unusual(ld->log, "subd %s failed: %s",
|
||||||
|
|||||||
@@ -4230,8 +4230,7 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
l2.daemon.wait_for_log('onchaind complete, forgetting peer')
|
l2.daemon.wait_for_log('onchaind complete, forgetting peer')
|
||||||
|
|
||||||
def test_io_logging(self):
|
def test_io_logging(self):
|
||||||
l1 = self.node_factory.get_node(options={'debug-subdaemon-io': 'channeld',
|
l1 = self.node_factory.get_node(options={'log-level': 'io'})
|
||||||
'log-level': 'io'})
|
|
||||||
l2 = self.node_factory.get_node()
|
l2 = self.node_factory.get_node()
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||||
|
|
||||||
@@ -4250,6 +4249,9 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
pid2 = re.search(r'pid ([0-9]*),', pidline).group(1)
|
pid2 = re.search(r'pid ([0-9]*),', pidline).group(1)
|
||||||
l2.daemon.wait_for_log(' to CHANNELD_NORMAL')
|
l2.daemon.wait_for_log(' to CHANNELD_NORMAL')
|
||||||
|
|
||||||
|
# Send it sigusr1: should turn on logging.
|
||||||
|
subprocess.run(['kill', '-USR1', pid1])
|
||||||
|
|
||||||
fut = self.pay(l1, l2, 200000000, async=True)
|
fut = self.pay(l1, l2, 200000000, async=True)
|
||||||
|
|
||||||
# WIRE_UPDATE_ADD_HTLC = 128 = 0x0080
|
# WIRE_UPDATE_ADD_HTLC = 128 = 0x0080
|
||||||
@@ -4268,7 +4270,7 @@ class LightningDTests(BaseLightningDTests):
|
|||||||
assert not l1.daemon.is_in_log(r'channeld.*:\[IN\] 0082',
|
assert not l1.daemon.is_in_log(r'channeld.*:\[IN\] 0082',
|
||||||
start=l1.daemon.logsearch_start)
|
start=l1.daemon.logsearch_start)
|
||||||
|
|
||||||
# IO logs should appear in peer logs.
|
# IO logs should not appear in peer logs.
|
||||||
peerlog = l2.rpc.listpeers(l1.info['id'], "io")['peers'][0]['log']
|
peerlog = l2.rpc.listpeers(l1.info['id'], "io")['peers'][0]['log']
|
||||||
assert not any(l['type'] == 'IO_OUT' or l['type'] == 'IO_IN'
|
assert not any(l['type'] == 'IO_OUT' or l['type'] == 'IO_IN'
|
||||||
for l in peerlog)
|
for l in peerlog)
|
||||||
|
|||||||
Reference in New Issue
Block a user