terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

cdktf synth poor performance when installed globally

Open Zyntogz opened this issue 6 months ago • 0 comments

Expected Behavior

Around 15 seconds execution time for my small sample project (like cdktf synth time in poetry/pipenv venv)

Actual Behavior

Around 48 seconds execution time (when using global dependencies as non-root user)

Steps to Reproduce

  1. Create a small Container Image containing all dependencies and install the same python dependencies a) globally b) using poetry venv c) using pipenv For ease of use, you can use this repository containing relevant snippets of our repo: https://github.com/Zyntogz/cdktf-bugreport
  2. Start VS Code Dev Container (or simply the image in general)
  3. Execute cdktf synth using each of the aforementioned configs a) time cdktf synth (for running using global python packages) b) time poetry run cdktf synth (for running using poetry's venv) c) time pipenv run cdktf synth (for running using pipenv's venv)

Versions

[dev-user@538780f9b082 cdktf]$ cdktf debug cdktf debug language: python cdktf-cli: 0.20.8 node: v18.18.2 cdktf: 0.20.8 constructs: 10.3.0 jsii: 1.102.0 terraform: 1.9.4 arch: x64 os: linux 5.15.123.1-microsoft-standard-WSL2 python: Python 3.9.16 pip: pip 24.2 from /usr/local/lib/python3.11/site-packages/pip (python 3.11) pipenv: pipenv, version 2024.0.1 providers cdktf-cdktf-provider-aws (PREBUILT) terraform provider version: 5.62.0 prebuilt provider version: 19.30.0 cdktf version: ^0.20.0 [dev-user@538780f9b082 cdktf]$ poetry run cdktf debug [2024-08-15T11:40:07.296] [ERROR] default - Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. [2024-08-15T11:40:08.766] [ERROR] default - Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. [2024-08-15T11:40:08.783] [ERROR] default - Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. [2024-08-15T11:40:08.822] [ERROR] default - Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. cdktf debug language: python cdktf-cli: 0.20.8 node: v18.18.2 cdktf: 0.20.8 constructs: 10.3.0 jsii: 1.102.0 terraform: 1.9.4 arch: x64 os: linux 5.15.123.1-microsoft-standard-WSL2 python: Python 3.11.6 pip: pip 24.1 from /home/dev-user/.cache/pypoetry/virtualenvs/qdwh-cdktf-9TtSrW0h-py3.11/lib/python3.11/site-packages/pip (python 3.11) pipenv: pipenv, version 2024.0.1 providers cdktf-cdktf-provider-aws (PREBUILT) terraform provider version: 5.62.0 prebuilt provider version: 19.30.0 cdktf version: ^0.20.0 [dev-user@538780f9b082 cdktf]$ pipenv run cdktf debug cdktf debug language: python cdktf-cli: 0.20.8 node: v18.18.2 cdktf: 0.20.8 constructs: 10.3.0 jsii: 1.102.0 terraform: 1.9.4 arch: x64 os: linux 5.15.123.1-microsoft-standard-WSL2 python: Python 3.11.6 pip: pip 24.1 from /home/dev-user/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.11/site-packages/pip (python 3.11) pipenv: pipenv, version 2024.0.1 providers cdktf-cdktf-provider-aws (PREBUILT) terraform provider version: 5.62.0 prebuilt provider version: 19.30.0 cdktf version: ^0.20.0

Providers

[dev-user@538780f9b082 cdktf]$ cdktf provider list ┌───────────────┬──────────────────┬─────────┬────────────┬──────────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────┼──────────────────┼─────────┼────────────┼──────────────────────────┼─────────────────┤ │ aws │ 5.62.0 │ ^0.20.0 │ │ cdktf-cdktf-provider-aws │ 19.30.0 │ └───────────────┴──────────────────┴─────────┴────────────┴──────────────────────────┴─────────────────┘ [dev-user@538780f9b082 cdktf]$ poetry run cdktf provider list [2024-08-15T11:37:41.655] [ERROR] default - Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning. ┌───────────────┬──────────────────┬─────────┬────────────┬──────────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────┼──────────────────┼─────────┼────────────┼──────────────────────────┼─────────────────┤ │ aws │ 5.62.0 │ ^0.20.0 │ │ cdktf-cdktf-provider-aws │ 19.30.0 │ └───────────────┴──────────────────┴─────────┴────────────┴──────────────────────────┴─────────────────┘ [dev-user@538780f9b082 cdktf]$ pipenv run cdktf provider list ┌───────────────┬──────────────────┬─────────┬────────────┬──────────────────────────┬─────────────────┐ │ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │ ├───────────────┼──────────────────┼─────────┼────────────┼──────────────────────────┼─────────────────┤ │ aws │ 5.62.0 │ ^0.20.0 │ │ cdktf-cdktf-provider-aws │ 19.30.0 │ └───────────────┴──────────────────┴─────────┴────────────┴──────────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

Container is running inside a WSL not using Docker Desktop as backend, instead running natively installed docker daemon (but I don't think that's the problem here)

References

No response

Help Wanted

  • [ ] I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Zyntogz avatar Aug 15 '24 12:08 Zyntogz