Skip to content
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

Avoid writing ChannelManager when hitting lnd bug 6039 #2937

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

When we hit lnd bug 6039, we end up sending error messages to peers in a loop. This should be fine, but because we used the generic PersistenceNotifierGuard::notify_on_drop lock above the specific handling, we end up writing ChannelManager every time we manage a round-trip to our peer.

This can add up quite quickly, and isn't actually changing, so we really need to avoid writing the ChannelManager in this case.

@G8XSU
Copy link
Contributor

G8XSU commented Mar 14, 2024

Build failure: ln::shutdown_tests::test_lnd_bug_6039

When we hit lnd bug 6039, we end up sending error messages to peers
in a loop. This should be fine, but because we used the generic
`PersistenceNotifierGuard::notify_on_drop` lock above the specific
handling, we end up writing `ChannelManager` every time we manage a
round-trip to our peer.

This can add up quite quickly, and isn't actually changing, so we
really need to avoid writing the `ChannelManager` in this case.
@codecov-commenter
Copy link

Codecov Report

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

Project coverage is 89.20%. Comparing base (f5ee8c2) to head (03425e4).
Report is 2 commits behind head on main.

Files Patch % Lines
lightning/src/ln/channelmanager.rs 90.62% 1 Missing and 2 partials ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2937      +/-   ##
==========================================
- Coverage   89.20%   89.20%   -0.01%     
==========================================
  Files         117      117              
  Lines       95513    95522       +9     
  Branches    95513    95522       +9     
==========================================
+ Hits        85203    85209       +6     
- Misses       7822     7831       +9     
+ Partials     2488     2482       -6     

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

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!
Waiting for CI to approve.
To me it looks safe, your call to wait for another reviewer or not.

@@ -9242,8 +9242,6 @@ where
}

fn handle_error(&self, counterparty_node_id: &PublicKey, msg: &msgs::ErrorMessage) {
let _persistence_guard = PersistenceNotifierGuard::notify_on_drop(self);

match &msg.data as &str {
"cannot co-op close channel w/ active htlcs"|
"link failed to shutdown" =>
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated: is it safe to rely on these string messages?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the worst case lnd changes the messages and we force-close instead of sending a repeated shutdown, so...it should be?

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.

None yet

5 participants