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

Fix race condition in testdiscoveryengine #1002

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

benbierens
Copy link
Contributor

@benbierens benbierens commented Nov 26, 2024

Requesting the same CID sometimes causes a worker to discard the request while another worker has the same CID in-flight.

while peerStore.len < minPeers:
discoveryEngine.queueFindBlocksReq(@[blocks[0].cid])
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, but can't this happen in production settings too? Like, us requesting the same block more than once? Will the requests then maybe get cancelled sometimes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you request discovery for a CID that's already in progress, the discovery engine will ignore it. This is the behavior we want. It's just that the test was running into this sometimes when it didn't want to.

Copy link
Member

@gmega gmega left a comment

Choose a reason for hiding this comment

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

I think I understand the change, my only worry is that this is a bug that also happens in production? If this is due to our test findBlocksProviderHandler, then LGTM. Will approve and you decide if it needs more work or not.

@benbierens benbierens added this pull request to the merge queue Nov 27, 2024
Merged via the queue into master with commit 2124996 Nov 27, 2024
17 checks passed
@benbierens benbierens deleted the bug/fixes-racecondition-testdiscoveryengine branch November 27, 2024 08:39
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.

2 participants