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 when --parallel is used with a large number of dependent services #10544

Merged
merged 1 commit into from May 10, 2023

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented May 9, 2023

What I did
dependency graph traversal has been implemented with recursive calls, this prevent the error group max concurrency to be used as a parallel limit: a Node visitor, once completed, won't leave the routine concurrent slot for another use.

This PR changes the approach by introducing a "controller" routine, responsible to trigger visit of the adjacent nodes. Visitor notify abut completion by aa channel, doing so the routine can complete. This require limit to be set to concurrency + 1 for the controller. Controller exits after all nodes have been visited.

Related issue
fixes #10532

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@ndeloof ndeloof requested review from a team, nicksieger, StefanScherer, ulyssessouza, glours, milas and laurazard and removed request for a team May 9, 2023 12:40
@ndeloof ndeloof force-pushed the parallel_race branch 3 times, most recently from e453368 to ad25e52 Compare May 9, 2023 13:47
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Patch coverage: 92.00% and project coverage change: +0.08 🎉

Comparison is base (0c1a691) 59.81% compared to head (e92c5d1) 59.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2   #10544      +/-   ##
==========================================
+ Coverage   59.81%   59.89%   +0.08%     
==========================================
  Files         107      107              
  Lines        9294     9306      +12     
==========================================
+ Hits         5559     5574      +15     
+ Misses       3166     3165       -1     
+ Partials      569      567       -2     
Impacted Files Coverage Δ
pkg/compose/dependencies.go 88.70% <92.00%> (+2.69%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ndeloof ndeloof force-pushed the parallel_race branch 5 times, most recently from e0b010a to c8cbcee Compare May 9, 2023 16:42
Copy link
Contributor

@milas milas left a comment

Choose a reason for hiding this comment

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

LGTM, nice find

Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM

…ervices

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@glours glours enabled auto-merge May 10, 2023 09:39
@glours glours merged commit 3b32a26 into docker:v2 May 10, 2023
24 checks passed
@ndeloof ndeloof deleted the parallel_race branch December 20, 2023 13:49
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.

[BUG] docker compose up hangs with no output when resolving deps with --parallel limit
3 participants