-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Docker compose using depends_on can lead to duplicate graph traversals #9014
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Can this be un-staled? :) We're seeing this too in 2.6.0. |
This issue has been automatically marked as not stale anymore due to the recent activity. |
We also see this in the latest stable version. |
We also have this issue with Compose 2.6.0. In our CI pipeline, it happens quite often, at approximately 5-10% of runs. Considering that we have 10 configurations to run for every commit, the pipeline for almost every commit finishes with such failure. Is there any chance that the issue will be investigated? |
Description
docker-compose up
fails because of creating a duplicate container -- we're not specifying replicas (and not setting the value), but it seems like it's trying to create the same container twice.Can yield:
Upon further investigation, the graph traversal algorithm may have a race condition. With a common parent, this can trigger multiple traversals to the parent and cause Docker creation to fail. Basically the algorithm appears to be:
The problem seems to be that both kochiku_mysql and kochiku_redis pointing to the same parent, so we launch multiple Goroutines to start them up. It seems as if filterAdjacentByStatusFn and updateStatus is the source of the race condition. If both calls to updateStatus completes before the filterAdjacentByStatusFn routine, we will see the parent being visited twice. I think there needs to be code added to check for already visited parent nodes.
Steps to reproduce the issue:
What I did
compose/pkg/compose/dependencies.go
Lines 93 to 109 in 8a9c4b5
Related issue
Describe the results you received:
Every so often, I'd see:
Describe the results you expected:
Watch every so often the output vary between GOOD:
Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker info
:Additional environment details:
Repro'd locally on a MacOS with IntellIJ and the latest master. Problem shows up on latest Linux Docker versions.
The text was updated successfully, but these errors were encountered: