Skip to content

Make fuzz_threaded_connections more robust #2074

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

In fuzz_threaded_connections, if one thread is being run while another is starved, and the running thread manages to call timer_tick_ocurred twice after the starved thread constructs the inbound connection but before it delivers the first bytes, we'll receive an immediate error and unwrap it, causing failure.

The fix is trivial, simply remove the unwrap and return if we're already disconnected when we do the initial read.

While we're here, we also reduce the frequency of the timer_tick_ocurred calls to give us a chance to occasionally deliver some additional messages.

Fixes #2073

In `fuzz_threaded_connections`, if one thread is being run while
another is starved, and the running thread manages to call
`timer_tick_ocurred` twice after the starved thread constructs the
inbound connection but before it delivers the first bytes, we'll
receive an immediate error and `unwrap` it, causing failure.

The fix is trivial, simply remove the unwrap and return if we're
already disconnected when we do the initial read.

While we're here, we also reduce the frequency of the
`timer_tick_ocurred` calls to give us a chance to occasionally
deliver some additional messages.

Fixes lightningdevkit#2073
@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (af76fac) 87.18% compared to head (d64e1b9) 87.18%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2074      +/-   ##
==========================================
- Coverage   87.18%   87.18%   -0.01%     
==========================================
  Files         100      100              
  Lines       44743    44744       +1     
  Branches    44743    44744       +1     
==========================================
  Hits        39008    39008              
- Misses       5735     5736       +1     
Impacted Files Coverage Δ
lightning/src/ln/peer_handler.rs 60.80% <100.00%> (-0.06%) ⬇️
lightning/src/util/events.rs 24.92% <0.00%> (-0.58%) ⬇️
lightning/src/ln/peer_channel_encryptor.rs 91.55% <0.00%> (+0.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@TheBlueMatt TheBlueMatt merged commit 7b2537b into lightningdevkit:main Mar 6, 2023
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.

fuzz_threaded_connections is flaky
4 participants