diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 4ec244964..c838a1b6b 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -1412,6 +1412,14 @@ int main(int argc, char *argv[]) /*~ Now handle sigchld, so we can clean up appropriately. */ sigchld_conn = notleak(io_new_conn(ld, sigchld_rfd, sigchld_rfd_in, ld)); + /* This span was started before handing control to `io_loop` + * which suspends active spans in-between processing + * events. Depending on how the `io_loop` was interrupted, the + * current context span may have been suspended. We need to + * manually resume it for this case. Notice that resuming is + * idempotent, and doing so repeatedly is safe. + */ + trace_span_resume(argv); trace_span_end(argv); /*~ Mark ourselves live. diff --git a/lightningd/test/run-find_my_abspath.c b/lightningd/test/run-find_my_abspath.c index 0c2039df7..53b22f4e5 100644 --- a/lightningd/test/run-find_my_abspath.c +++ b/lightningd/test/run-find_my_abspath.c @@ -263,6 +263,9 @@ void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED) /* Generated stub for trace_span_end */ void trace_span_end(const void *key UNNEEDED) { fprintf(stderr, "trace_span_end called!\n"); abort(); } +/* Generated stub for trace_span_resume_ */ +void trace_span_resume_(const void *key UNNEEDED, const char *lbl UNNEEDED) +{ fprintf(stderr, "trace_span_resume_ called!\n"); abort(); } /* Generated stub for trace_span_start */ void trace_span_start(const char *name UNNEEDED, const void *key UNNEEDED) { fprintf(stderr, "trace_span_start called!\n"); abort(); }