Skip to content

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

Merged
gammazero merged 4 commits into
mainfrom
feat/do-not-record-what-did-not-happen
Dec 4, 2024
Merged

gammazero merged 4 commits into
mainfrom
feat/do-not-record-what-did-not-happen

Conversation

@hannahhoward

@hannahhoward hannahhoward commented Aug 23, 2023 •

Copy link
Copy Markdown
Contributor

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

codecov Bot commented Aug 23, 2023 •

Copy link
Copy Markdown

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

rvagg commented Aug 24, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
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

@hsanjuan hsanjuan left a comment

Copy link
Copy Markdown
Contributor

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
@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