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

[Merged by Bors] - Add sleep to make data race less likely #6231

Closed
wants to merge 1 commit into from

Conversation

fasmat
Copy link
Member

@fasmat fasmat commented Aug 8, 2024

Motivation

This adds sleeps to tests in the fetch package to hopefully make data races less likely.

Description

libp2p/go-libp2p-pubsub internally uses a go routine with a for loop that only returns when the context is canceled. See the code here: https://github.com/libp2p/go-libp2p-pubsub/blob/19ffbb3a482caecabb8520917c631e3047a78094/pubsub.go#L668-L671

Since this signal might not reach the go routine before the test ends the log that is emitted might use the test logger of a different test causing a race. Since there is no way to not use a global logger or any signal back from PubSub that the go routine exited, the only thing we can do without changing libp2p/go-libp2p-pubsub is to sleep in the test for some time and hope that ensures the go routine exited.

Test Plan

existing tests pass and are less flaky

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

@fasmat fasmat self-assigned this Aug 8, 2024
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.1%. Comparing base (c25d28c) to head (0b53859).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #6231   +/-   ##
=======================================
  Coverage     82.0%   82.1%           
=======================================
  Files          309     309           
  Lines        34120   34120           
=======================================
+ Hits         28010   28018    +8     
+ Misses        4327    4320    -7     
+ Partials      1783    1782    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fasmat
Copy link
Member Author

fasmat commented Aug 8, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 8, 2024
## Motivation

This adds sleeps to tests in the `fetch` package to hopefully make data races less likely.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 8, 2024

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Aug 8, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 8, 2024
## Motivation

This adds sleeps to tests in the `fetch` package to hopefully make data races less likely.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 8, 2024

Build failed:

@fasmat
Copy link
Member Author

fasmat commented Aug 8, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 8, 2024
## Motivation

This adds sleeps to tests in the `fetch` package to hopefully make data races less likely.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 8, 2024

Build failed:

  • systest-status

@fasmat
Copy link
Member Author

fasmat commented Aug 8, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Aug 8, 2024
## Motivation

This adds sleeps to tests in the `fetch` package to hopefully make data races less likely.
@spacemesh-bors
Copy link

spacemesh-bors bot commented Aug 8, 2024

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title Add sleep to make data race less likely [Merged by Bors] - Add sleep to make data race less likely Aug 8, 2024
@spacemesh-bors spacemesh-bors bot closed this Aug 8, 2024
@spacemesh-bors spacemesh-bors bot deleted the fix-flaky-p2p-tests branch August 8, 2024 15:51
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