Skip to content

Fix fuzz deadlock #3490

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 4 commits into from
Dec 17, 2024
Merged

Conversation

TheBlueMatt
Copy link
Collaborator

and a tiny test improvement from #3481

This marginally expands the test coverage in our persister
`do_test_data_migration` test.
bcaba29 introduced a deadlock in
the `chanmon_consistency` fuzzer by holding a lock on the route
expectations before sending a payment, which ultimately tries to
lock the route expectations. Here we fix this deadlock.
@TheBlueMatt TheBlueMatt added this to the 0.1 milestone Dec 17, 2024
bcaba29 started returning
pre-built `Route`s from the router in the `chanmon_consistency`
fuzzer. In doing so, it didn't properly fill in the `route_parms`
field which is expected to match the requested parameters. This
causes a debug assertion when sending.

Here we fix this by setting the correct `route_params`.
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.07%. Comparing base (dcc531e) to head (609428f).

Files with missing lines Patch % Lines
lightning/src/ln/outbound_payment.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3490      +/-   ##
==========================================
- Coverage   88.07%   88.07%   -0.01%     
==========================================
  Files         148      148              
  Lines      111773   111782       +9     
  Branches   111773   111782       +9     
==========================================
  Hits        98447    98447              
- Misses      10833    10839       +6     
- Partials     2493     2496       +3     

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

Prior to bcaba29, the
`chanmon_consistency` fuzzer checked that payments sent either
succeeded or failed as expected by looking at the `APIError` which
we received as a result of calling the send method.

bcaba29 removed the legacy send
method during fuzzing so attempted to replicate the old logic by
checking for events which contained the legacy `APIError` value.
While this was plenty thorough, it was somewhat brittle in that it
made expectations about the event state of a `ChannelManager` which
turned out to not be true.

Instead, here, we validate the send correctness by examining the
`RecentPaymentDetails` list from a `ChannelManager` immediately
after sending.
Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

Too bad about the bugs in bcaba29, I thought CI ran the fuzzers and would've uncovered the deadlock but I guess not? I was having macOS problems getting the fuzzers working locally so relied on CI too much..

@@ -1226,7 +1226,8 @@ impl OutboundPayments {

if route.route_params.as_ref() != Some(route_params) {
debug_assert!(false,
"Routers are expected to return a Route which includes the requested RouteParameters");
"Routers are expected to return a Route which includes the requested RouteParameters. Got {:?}, expected {:?}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... Should we have made the route params field required in Route for 0.1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe? No huge rush, really...

@valentinewallace valentinewallace merged commit 0e6f47e into lightningdevkit:main Dec 17, 2024
17 of 19 checks passed
@valentinewallace
Copy link
Contributor

If someone (@tnull? @G8XSU?) that worked on KVStore more wants to take a glance at the first commit, post-merge review would be welcome.

Fuzz failure looks unrelated, looks like github silently timed out the fuzz build :(

@G8XSU
Copy link
Contributor

G8XSU commented Dec 17, 2024

First commit [54725ce] looks 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.

3 participants