Skip to content

vcpkg doesn't fail and consumes RAM when a library lists itself as a dependency #48892

@doobiusP

Description

@doobiusP

Describe the bug
I was in the process of breaking my library's external dependencies into separate features. Some CMake components depend on other components in my project and I needed to reflect that in the external dependencies in vcpkg.json. I naively thought this would work:

{
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
  "name": "mylib2",
  "description": "MyLib2 short description",
  "default-features": ["core-lib", "math", "tests"],
  "features": {
    "core-lib": {
      "description": "Dependencies for core component",
      "dependencies": [
        "zlib"
      ]
    },
    "math": {
      "description": "Dependencies for math component",
      "dependencies": [
        {
          "name": "mylib2",
          "features": [
            "core-lib"
          ]
        }
      ]
    },
    "tests": {
      "description": "Build mylib2 tests option",
      "dependencies": [
        {
          "name": "mylib2",
          "features": [
            "core-lib",
            "math"
          ]
        },
        {
          "name": "boost-test",
          "version>=": "1.88.0"
        }
      ]
    }
  }
}

And in fact invoking vcpkg either via CMake or the CLI in manifest mode allowed this to run. But soon after vcpkg will just hang consuming large amounts of RAM while being stuck on the
Fetching registry information from https://github.com/microsoft/vcpkg (HEAD)...
output line. It doesnt even perform file I/O but on my PC, the vcpkg instance was steadily climbing to around 10 GB RAM usage.

If this recursive behavior is not supported, it should ideally be an error.

Environment

  • OS: Windows 11
  • Compiler: Visual Studio 17 2022 (Latest MSVC cl version)

To Reproduce
Steps to reproduce the behavior:

  1. Copy my vcpkg.json into a test folder
  2. Run vcpkg install
  3. Inspect RAM usage and notice no further progress of vcpkg

Expected behavior
This should have failed to indicate recursive dependencies between features are not allowed.

Failure logs
None because its not counted as a failure right now

Additional context
None

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