Skip to content

Fix COMPOSE_PARALLEL_LIMIT #8226

Description

@pagelypete

Description of the issue

There have already been multiple issues opened about this bug:
#7486
#5864

A PR already seems to exist which fixes the issue which was posted with reference to #5864 - could this be checked, tested, and merged so this bug can finally be fixed in master?

The bug causes a fairly critical issue, it completely deadlocks compose, and in the worst case scenario, it also seems to be able to cause interactions with the Docker daemon to hang due to the amount of open connections it is holding.

The bug is worse when your compose file is dynamically generated, and can contain varying numbers of services, which means that you have to set a global system wide environment variable to be an arbitrarily high number - completely defeating the point of the variable in the first place (to reduce CPU usage for container operations).

Anecdotally, I have tested that PR on 1.28.5, and up/down/restart/etc. operations all seem to work. In a service file with 150 services, this deadlocks on master:

COMPOSE_PARALLEL_LIMIT=2 docker-compose up -d --remove-orphans

With the linked PR, it does not, and actually functions as you would expect (essentially sequentially bringing up the containers)

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.28.5, build unknown
docker-py version: 4.4.4
CPython version: 3.8.6
OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020

Steps to reproduce the issue

  1. Create a docker-compose.yml file with a lot of services (ideally 100+)
  2. Set COMPOSE_PARALLEL_LIMIT to 2 and run an up operation

Observed result

Compose will deadlock.

Expected result

Compose should bring up containers using the parallel limit.

Stacktrace / full error message

N/A

Additional information

Not relevant

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions