Skip to content
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

Poetry install gets killed OOM #3756

Closed
3 tasks done
rednaks opened this issue Mar 5, 2021 · 7 comments
Closed
3 tasks done

Poetry install gets killed OOM #3756

rednaks opened this issue Mar 5, 2021 · 7 comments
Labels
status/external-issue Issue is caused by external project (platform, dep, etc)

Comments

@rednaks
Copy link

rednaks commented Mar 5, 2021

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: ubuntu 20.04.1
  • memory: 512M, free: 253M
  • Poetry version: 1.1.5
    logs:
Installing dependencies from lock file

Package operations: 60 installs, 0 updates, 0 removals

  • Installing asgiref (3.3.1): Installing...
  • Installing numpy (1.20.1): Installing...
  • Installing pycparser (2.20): Installing...
  • Installing pytz (2021.1): Installing...
  • Installing sqlparse (0.4.1): Installing...
  • Installing vine (5.0.0): Installing...
Killed

Issue

Noticed that today my server deployments fails during the poetry install task. after investigating, figured out that poetry is getting killed by the OS, Out Of Memory.

I have a machine with very limited resources, it was working fine until I updated poetry.

After doing some research I figured out that installer.parallel was added true by default in version 1.1.4. when I disabled the option the deployments are not failing anymore.

@rednaks rednaks added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Mar 5, 2021
@abn
Copy link
Member

abn commented Mar 5, 2021

Out of curiosity, is this machine a development environment or a target environment?

I suspect that the issue here is that the memory consumption is real since it is in parallel downloading, unpacking and installing (which might involve build/compile for packages like numpy). OS might be killing off the parent process. If this is not a leak, then the workaround that you have listed might be the actual solution for this scenario.

Maybe generating some profiles with something like https://pythonspeed.com/products/filmemoryprofiler/ might help triage the issue.

@rednaks
Copy link
Author

rednaks commented Mar 8, 2021

well, it's a dev machine, I don't have enough ram for everything so I minimized the VMs locally, I'll try the profiler but I'm wondering, how many tasks poetry executes in parallel ? I see here he's trying to install 6 packages simultaneously I would be really concerned if the same thing happens on production and creates 100 process for installing all the dependencies at once.

My machine have 2 cores, poetry could use the number of CPUs (or 2 * CPUs) to execute parallel tasks and of course an option would be welcome.

@abn
Copy link
Member

abn commented Mar 21, 2021

I believe you are looking for

if parallel:
# This should be directly handled by ThreadPoolExecutor
# however, on some systems the number of CPUs cannot be determined
# (it raises a NotImplementedError), so, in this case, we assume
# that the system only has one CPU.
try:
self._max_workers = os.cpu_count() + 4
except NotImplementedError:
self._max_workers = 5
else:
self._max_workers = 1
.

I suspect we will need a new configuration and update the defaults maybe.

paxcodes added a commit to paxcodes/portfolio_api that referenced this issue Jun 4, 2021
Doing poetry install causes CPU usage to reach ~100% for an instance that has only one CPU.

Possible relevant issues
python-poetry/poetry#3756
python-poetry/poetry#3010
paxcodes added a commit to paxcodes/dicery_backend that referenced this issue Jun 4, 2021
Doing poetry install causes CPU usage to reach ~100% for an instance that has only one CPU.

Possible relevant issues
python-poetry/poetry#3756
python-poetry/poetry#3010
@rednaks
Copy link
Author

rednaks commented Jun 16, 2021

Hello, any news on this issue ? the only solution I'm using right now is to disable parallel.
I think it's really dangerous especially when you download modules that compile things in C. if for example make is also using parallel jobs -jX it becomes a systematic issue ..

@dimbleby
Copy link
Contributor

dimbleby commented Oct 5, 2022

I expect it's compiling numpy that is burning through RAM anyway - there's nothing much poetry can do about that.

If disabling parallel works for you, great, do that. Or allocate more RAM to your VMs, 512M really isn't very much at all these days.

Pretty sure that there'll be no poetry fix here.

@neersighted neersighted added status/external-issue Issue is caused by external project (platform, dep, etc) and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 5, 2022
@neersighted
Copy link
Member

Correct, this is wontfix. We can tune the default parallelism, but at the end of the day if the default is too aggressive for your system resources, that's why we have the knob.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

No branches or pull requests

4 participants