Skip to content

High CPU usage #27

Closed
Closed

Description

@pranas

I've noticed container-compose up is using 100% CPU (on a single core) after starting all the containers from docker-compose.yml. There's likely an issue with polling logs/state. A workaround is to exit the command after starting, the containers will keep running.

Activity

  1. Cyb3rDudu commented on May 4, 2026

    @Cyb3rDudu
    Contributor

    Confirmed on main. Reproduces with any compose file run without -d — single container running sleep 60, the container-compose process holds 100% on one core.

    The hot loop is ComposeUp.swift::waitForever:

    for await _ in AsyncStream<Void>(unfolding: {}) {
        // This will never run
    }

    AsyncStream<Void>(unfolding: () async -> Void?) ends only when the closure returns nil. The empty closure returns (), which Swift auto-wraps as .some(()) — never nil — so the stream emits infinitely with no await between iterations. The body runs constantly; the // This will never run comment is inverted.

    PR #82 swaps the busy loop for withUnsafeContinuation { _ in }. Same repro after the fix shows 0.0 container-compose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions