Skip to content

fix: prevent git progress writer race reading stageNumber #309

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
merged 2 commits into from
Aug 12, 2024

Conversation

mafredri
Copy link
Member

Since the progress writer runs in a goroutine, it can call the write
function after the git operation has exited and while the next stage is
starting, resulting in a race. This fixes the race by using a second
variable and closing the writer early.

An alternative fix is to rewrite the progress writer to be synchronous.

Since the progress writer runs in a goroutine, it can call the write
function after the git operation has exited and while the next stage is
starting, resulting in a race. This fixes the race by using a second
variable and closing the writer early.

An alternative fix is to rewrite the progress writer to be synchronous.
@mafredri mafredri self-assigned this Aug 12, 2024
@mafredri mafredri requested a review from johnstcn August 12, 2024 09:40
@mafredri mafredri merged commit 7c486bb into main Aug 12, 2024
4 checks passed
@mafredri mafredri deleted the mafredri/fix-progresswriter-race branch August 12, 2024 09:52
johnstcn pushed a commit that referenced this pull request Aug 15, 2024
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