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

feat(session): do not record erroneous session want sends #452

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

hannahhoward
Copy link
Contributor

@hannahhoward hannahhoward commented Aug 23, 2023

Goals

Find acceptable fix for #432

Implementation

The basic idea here is there's nothing wrong with the connection event manager -- the problem lies in the fact that the PeerManager never tells the caller it didn't actually send anything cause the peer appeared disconnected. The SessionWantSender in turn updates the state of sent wants based on incorrect assumption something actually happened. This PR deals with the problem by helping the SessionWantSender avoid getting into an incorrect state by not updating its state when SendWants does nothing.

The subsequent connect event should trigger the sending of the WantBlock then.

For discussion

This is just an experiment and a suggestion for someone else to pick up, to help solve #432 more quickly -- I'm not doing the leg work of testing and change log etc

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.44%. Comparing base (5965637) to head (2d6338d).
Report is 1 commits behind head on main.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #452      +/-   ##
==========================================
+ Coverage   60.42%   60.44%   +0.01%     
==========================================
  Files         245      245              
  Lines       31056    31064       +8     
==========================================
+ Hits        18766    18777      +11     
+ Misses      10621    10616       -5     
- Partials     1669     1671       +2     
Files with missing lines Coverage Δ
bitswap/client/internal/peermanager/peermanager.go 91.85% <100.00%> (+0.12%) ⬆️
bitswap/client/internal/session/session.go 90.53% <ø> (ø)
...tswap/client/internal/session/sessionwantsender.go 96.03% <100.00%> (+0.05%) ⬆️

... and 9 files with indirect coverage changes

@rvagg
Copy link
Member

rvagg commented Aug 24, 2023

seems reasonable, aside from probably needing some form of cleanup for cases where the error doesn't ever resolve - we don't want to continue to try this in perpetuity, unless there is already an alternative cleanup mechanism in place for these wants

@hannahhoward
Copy link
Contributor Author

Presumably, the case where the error does not resolve is one where a peer has disconnected, in which case, we will eventually get a disconnected message.

@gammazero gammazero force-pushed the feat/do-not-record-what-did-not-happen branch from 86a7a45 to eedee67 Compare December 4, 2024 05:31
@gammazero gammazero force-pushed the feat/do-not-record-what-did-not-happen branch from d3e88f1 to 643278e Compare December 4, 2024 05:59
@gammazero gammazero marked this pull request as ready for review December 4, 2024 05:59
@gammazero gammazero requested a review from a team as a code owner December 4, 2024 05:59
@gammazero gammazero added need/maintainers-input Needs input from the current maintainer(s) need/triage Needs initial labeling and prioritization labels Dec 4, 2024
@gammazero gammazero requested a review from lidel December 4, 2024 06:15
Copy link
Contributor

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

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

LGTM. Let's try it out.

@gammazero gammazero merged commit 86120e2 into main Dec 4, 2024
17 checks passed
@gammazero gammazero deleted the feat/do-not-record-what-did-not-happen branch December 4, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/maintainers-input Needs input from the current maintainer(s) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants