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

incoming / outgoing / sent block hooks called again for each block on restart #141

Closed
dirkmc opened this issue Jan 5, 2021 · 3 comments
Closed
Labels
need/triage Needs initial labeling and prioritization

Comments

@dirkmc
Copy link
Collaborator

dirkmc commented Jan 5, 2021

There are a couple of bugs open against lotus whereby the "transferred" field increases by the already sent/received data size each time a transfer is restarted: filecoin-project/lotus#5225 filecoin-project/lotus#5133

I believe the root cause is that when a data transfer is restarted, graphsync triggers hooks for all blocks that have already been sent or received for

  • RegisterIncomingBlockHook
  • RegisterOutgoingBlockHook
  • RegisterBlockSentListener

go-data-transfer also watches for these events in order to detect whether a reconnect has occurred.

I think it would make most sense for these events to only be triggered when the block has actually been sent / received over the network.
Alternatively the event could still fire, but the event data could include a flag indicating whether the block was sent / received over the network.

@hannahhoward
Copy link
Collaborator

Hi @dirkmc,

From graphsync's point of view, these are two different and unrelated requests, with the second having a list of CID's not to send on the wire. I'm not sure what can be done in this case -- I think the architecture is correct for go-graphsync.

Two things you can do is keep a running total of bytes sent (since that is in the BlockData struct) and check the discrepency between BlockSize & BlockSizeOnWire (which will be different if the block was not sent on the wire)

@dirkmc
Copy link
Collaborator Author

dirkmc commented Jan 26, 2021

It seems like graphsync is resending some blocks with a non-zero block.BlockSizeOnWire() after a restart. I wrote a test to capture the issue:
filecoin-project/go-data-transfer#140

@dirkmc
Copy link
Collaborator Author

dirkmc commented Jan 29, 2021

Closing as the fix is at the go-data-transfer layer: filecoin-project/go-data-transfer#140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants