Skip to content

Log before and after Event processing calls #3449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

At various points we've had issues where Event processing for a user possibly is taking a long time, causing other things to stall. However, due to lack of logging during Event processing itself this can be rather difficult to debug. In
85eb814 we attempted to add logging for this, but in doing so ended up with more verbose logging than we were comfortable with.

Instead, here, we log only when we actually process an Event, directly in the callsite passing the Event to the user.

Fixes #3331

@TheBlueMatt TheBlueMatt added this to the 0.1 milestone Dec 6, 2024
dunxen
dunxen previously approved these changes Dec 6, 2024
Copy link
Member

@shaavan shaavan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM mod minor nits & @jkczyz comments 🚀

let future = ResultFuture::Pending(handler(ev));
futures.push(future);
}
// Let the `OnionMessageIntercepted` events finish before moving on to peer_connecteds
let res = MultiResultFuturePoller::new(futures).await;
log_trace!(self.logger, "Completed async events, got results {:?}", res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is following phrasing correct? Maybe this will feel clearer:

Suggested change
log_trace!(self.logger, "Completed async events, got results {:?}", res);
log_trace!(self.logger, "Async event processing completed. Results: {:?}", res);

let future = ResultFuture::Pending(handler(event));
futures.push(future);
}
let res = MultiResultFuturePoller::new(futures).await;
log_trace!(self.logger, "Completed async events, got results {:?}", res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too.

At various points we've had issues where `Event` processing for a
user possibly is taking a long time, causing other things to stall.
However, due to lack of logging during `Event` processing itself
this can be rather difficult to debug. In
85eb814 we attempted to add
logging for this, but in doing so ended up with more verbose
logging than we were comfortable with.

Instead, here, we log only when we actually process an `Event`,
directly in the callsite passing the `Event` to the user.

Fixes lightningdevkit#3331
@TheBlueMatt
Copy link
Collaborator Author

Unified logging around Handling event {:?}... and Done handling event, result: {:?}, with some "async" peppered in where appropriate.

Copy link
Contributor

@dunxen dunxen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jkczyz jkczyz merged commit fe1cf69 into lightningdevkit:main Dec 9, 2024
18 of 19 checks passed
@@ -3321,8 +3321,11 @@ macro_rules! process_events_body {

let mut num_handled_events = 0;
for (event, action_opt) in pending_events {
log_trace!($self.logger, "Handling event {:?}...", event);
Copy link
Contributor

@tnull tnull Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I could imagine this full Debug logging to be pretty spammy/verbose for some of the larger Event variants. I might be mistaken, but for larger nodes with a lot of traffic this might render TRACE logging infeasible? I wonder if we should either reuse (a renamed) GOSSIP level or introduce another finer-grained log level for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm skeptical - I don't think there's any Events that will be generated without printing at least one other log somewhere, if not 10s of other logs. Worst case for a node is probably some kind of onion messages that we'd already print once or twice for receiving and now print a third time. I think that's fine and honestly more visibility there is probably good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace verbose event processing logging
5 participants