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

Downgrade the API's python version back to 3.11 #5295

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

krysal
Copy link
Member

@krysal krysal commented Dec 19, 2024

Description

This PR downgrades the Python version to the previous one, 3.11.*, partially reverting #5095, to see if the API memory utilization slows down. Ideally, it should return to acceleration levels previous to release from November 4th (below 50% after 2 weeks).

Screenshot 2024-12-19 at 15-34-22 Dashboards ECS-Production-Dashboard CloudWatch us-east-1

The highest peak on the graph coincides with the update of aiohttp (#5165) but we wanted that to fix #4901. It may have been drived by the Django v5 upgrade too, see release from 2024.11.17. So it's easier to test the Python version downgrade first. If that doesn't alleviate the problem, we can go back to version 3.12 (or even further, bump to 3.13) and revert the aiohttp update.

I restricted the versions allowed in some API packages to avoid doing many updates of other dependencies here, and also had to loosen the required python version of the openverse-attribution package to be able to downgrade the API.

Testing Instructions

just build
just api/up

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog PRs) or the media properties generator (ov just catalog/generate-docs media-props for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@krysal krysal added 🟧 priority: high Stalls work on the project or its dependents 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🧱 stack: api Related to the Django API python Pull requests that update Python code labels Dec 19, 2024
@krysal krysal requested a review from a team as a code owner December 19, 2024 19:55
@krysal krysal requested review from obulat and dhruvkb and removed request for a team December 19, 2024 19:55
@krysal krysal requested a review from a team as a code owner December 19, 2024 21:34
Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the slope of the memory consumption definitely seems higher on the right side of the Python version bump (although it didn't get to as high of a peak as it does later on). I can get behind your reasoning for trying this out.

That said, this PR still updates a number of packages (even major versions in some cases). I think those will make it harder to pinpoint if it really was the Python version upgrade that caused the leak, and if it really was the Python version downgrade that fixed it.

In this PR, there are

  • patch upgrade in some packages: aiohappyeyeballs, aiosignal
  • major upgrade in some packages: anyio, asttokens
  • introduction of some new packages: async-timeout

Can we try downgrading the Python version, without changing any of the packages? I think PDM's --update-reuse flag will avoid changes to the versions in the lock file wherever possible.

pdm lock --update-reuse

@krysal
Copy link
Member Author

krysal commented Dec 20, 2024

Can we try downgrading the Python version, without changing any of the packages? I think PDM's --update-reuse flag will avoid changes to the versions in the lock file wherever possible.

Good call! That was the reason I was removing psycopg in the first place, so the command could work, but somehow I forget about it in the middle, lol. Pushing the changes as requested.


Edit: Regarding async-timeout, it was present before the upgrade to 3.12 so in this case, it makes sense for it to be restored.

@openverse-bot
Copy link
Collaborator

Based on the high urgency of this PR, the following reviewers are being gently reminded to review this PR:

@obulat
@dhruvkb
This reminder is being automatically generated due to the urgency configuration.

Excluding weekend1 days, this PR was ready for review 2 day(s) ago. PRs labelled with high urgency are expected to be reviewed within 2 weekday(s)2.

@krysal, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings.

Footnotes

  1. Specifically, Saturday and Sunday.

  2. For the purpose of these reminders we treat Monday - Friday as weekdays. Please note that the operation that generates these reminders runs at midnight UTC on Monday - Friday. This means that depending on your timezone, you may be pinged outside of the expected range.

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through both the lock files and it seems everything is good there. None of the IO package pins are changing so we'll be able to determine if the Python version itself was the cause of the trouble.

The attribution package has a number of updates to its packages but those should not be blocking because they're not related to IO and cannot be associated with the memory leak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟧 priority: high Stalls work on the project or its dependents python Pull requests that update Python code 🧱 stack: api Related to the Django API
Projects
Status: ✅ Approved
3 participants