Skip to content

Log pending in-flight updates when we are missing a monitor #2990

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
merged 2 commits into from
Apr 22, 2024

Conversation

TheBlueMatt
Copy link
Collaborator

If we are missing a ChannelMonitor for which the ChannelManager has pending updates, it may be useful to print what the updates we have actually are, at least useful in identifying the bug(s).

If we are missing a `ChannelMonitor` for which the `ChannelManager`
has pending updates, it may be useful to print what the updates we
have actually are, at least useful in identifying the bug(s).
@TheBlueMatt TheBlueMatt added this to the 0.0.123 milestone Apr 11, 2024
@TheBlueMatt
Copy link
Collaborator Author

Also started logging directly in ChainMonitor when updates complete.

@TheBlueMatt TheBlueMatt force-pushed the 2024-04-log-in-flights branch from 5398e40 to 73670e1 Compare April 12, 2024 13:44
@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2024

Codecov Report

Attention: Patch coverage is 97.50000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 91.56%. Comparing base (4bab9c8) to head (93e7763).
Report is 404 commits behind head on main.

Files Patch % Lines
lightning/src/ln/channelmanager.rs 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2990      +/-   ##
==========================================
+ Coverage   88.86%   91.56%   +2.69%     
==========================================
  Files         115      119       +4     
  Lines       92753   117849   +25096     
  Branches    92753   117849   +25096     
==========================================
+ Hits        82429   107910   +25481     
+ Misses       7942     7923      -19     
+ Partials     2382     2016     -366     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheBlueMatt TheBlueMatt force-pushed the 2024-04-log-in-flights branch from 73670e1 to 67e31ea Compare April 12, 2024 19:30
if !monitor_data.has_pending_chainsync_updates(&pending_monitor_updates) {
let monitor_has_pending_updates =
monitor_data.has_pending_chainsync_updates(&pending_monitor_updates);
log_debug!(self.logger, "Completed chain sync monitor update for channel with funding outpoint {:?}, {}",
Copy link
Contributor

Choose a reason for hiding this comment

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

did we leave out update_id intentionally in case of chain-sync?
I understand it resets b/w reloads/restarts but there still might be some correlation.

afaiu, the discussion on ldk-help was related to chain-sync. I am ok either way, just confirming.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because I'm already living in the future where we don't persist/block for chain-sync updates :). But, you're right, for now we should log them more clearly.

@TheBlueMatt TheBlueMatt force-pushed the 2024-04-log-in-flights branch from 67e31ea to ef6a00d Compare April 15, 2024 14:30
G8XSU
G8XSU previously approved these changes Apr 16, 2024
Copy link
Contributor

@G8XSU G8XSU left a comment

Choose a reason for hiding this comment

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

Lgtm!

log_trace!(logger, "Finished syncing Channel Monitor for channel {}", log_funding_info!(monitor)),
log_trace!(logger, "Finished syncing Channel Monitor for channel {} for block-data update_id {}",
log_funding_info!(monitor),
chain_sync_update_id
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: if we want to add update_id in case of completed, you might want to add it at L:821 as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be printed a few lines up so was being lazy but went ahead and did this.

G8XSU
G8XSU previously approved these changes Apr 18, 2024
@G8XSU
Copy link
Contributor

G8XSU commented Apr 18, 2024

CI is failing, good to merge otherwise.

When a `ChannelMonitor[Update]` persistence completes, we rely on
logging in `ChannelManager` to hear about it. However, this won't
happen at all if there's still pending updates as no `MonitorEvent`
will be generated.

Thus, here, we add logging directly in `ChainMonitor`, ensuring we
can deduce when individual updates completed from debug logs.
@TheBlueMatt
Copy link
Collaborator Author

Oops, sorry, fixed:

$ git diff-tree -U1 c614b42b 93e77632
diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs
index 3de8882e1..6e824d1e1 100644
--- a/lightning/src/chain/chainmonitor.rs
+++ b/lightning/src/chain/chainmonitor.rs
@@ -818,3 +818,3 @@ where C::Target: chain::Filter,
 						log_debug!(logger,
-							"Persistence of ChannelMonitorUpdate id {} for channel {} in progress",
+							"Persistence of ChannelMonitorUpdate id {:?} for channel {} in progress",
 							update_id,
@@ -825,3 +825,3 @@ where C::Target: chain::Filter,
 						log_debug!(logger,
-							"Persistence of ChannelMonitorUpdate id {} for channel {} completed",
+							"Persistence of ChannelMonitorUpdate id {:?} for channel {} completed",
 							update_id,

@G8XSU G8XSU merged commit d25d55a into lightningdevkit:main Apr 22, 2024
16 checks passed
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.

3 participants