Skip to content

fix: race condition when waiting for sharedError #474

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 1 commit into from
Jul 12, 2023

Conversation

4xposed
Copy link
Contributor

@4xposed 4xposed commented Jul 11, 2023

While debugging an issue with some files failing to upload we encountered that when calling: defer wg.Wait()
having a return statement, the return value would be assigned first, and then we would wait for the wait group, you can explore this issue on this playground link: https://go.dev/play/p/nuOytLQbkQy

Why it did not affect every single deploy?
Some Deploys returned some errors because they were blocked here: https://github.com/netlify/open-api/blob/master/go/porcelain/deploy.go#L433-L435 due to having too many files and waiting for the initialized semaphore, giving it a chance for sharedErr to have a value assigned before it be assigned to the return statement.

@4xposed 4xposed requested a review from a team as a code owner July 11, 2023 16:35
@netlify
Copy link

netlify bot commented Jul 11, 2023

Deploy Preview for open-api ready!

Name Link
🔨 Latest commit 40bd8f9
🔍 Latest deploy log https://app.netlify.com/sites/open-api/deploys/64ad851a308fcb0008942167
😎 Deploy Preview https://deploy-preview-474--open-api.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@4xposed 4xposed force-pushed the fix_race_condition_on_uploadFiles branch from c58df5a to 40bd8f9 Compare July 11, 2023 16:36
Copy link
Contributor

@JGAntunes JGAntunes left a comment

Choose a reason for hiding this comment

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

😫 😩

@4xposed 4xposed merged commit a50e2a9 into master Jul 12, 2023
@4xposed 4xposed deleted the fix_race_condition_on_uploadFiles branch July 12, 2023 07:40
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