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

[tmpnet] Avoid calling Stat in advance of Read/Open #3356

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

marun
Copy link
Contributor

@marun marun commented Sep 3, 2024

Why this should be merged

Checking for a file/dir in advance of attempting to open it is redundant and invites race conditions where error handling is not duplicated:

https://github.com/ava-labs/avalanchego/actions/runs/10688505984/job/29628507363

How this works

Removes calls to Stat in tmpnet code and ensures error handling for ErrNotExist in the calls to read a file or dir.

How this was tested

CI

Checking for a file/dir in advance of attempting to open it is
redundant and invites race conditions:

https://github.com/ava-labs/avalanchego/actions/runs/10688505984/job/29628507363

Prefer checking for ErrNotExist in the call to read the file/dir.
@marun marun added the testing This primarily focuses on testing label Sep 3, 2024
@marun marun self-assigned this Sep 3, 2024
@StephenButtolph StephenButtolph added this to the v1.11.12 milestone Sep 4, 2024
@StephenButtolph StephenButtolph added this pull request to the merge queue Sep 4, 2024
Merged via the queue into master with commit f733ece Sep 4, 2024
21 checks passed
@StephenButtolph StephenButtolph deleted the tmpnet-fix-race branch September 4, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants