Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

media repo workers use an awful lot of memory #9365

Closed

Description

@richvdh

A lot of it gets cleaned up when we eventually do a gen 2 GC, but 44G seems a bit insane for a process which is essentially a glorified web server:

image

It would be good to find out what is using that memory, with a view to either not using it in the first place, or making it easier to free so that it gets removed in a gen 0 or gen 1 GC.

Activity

  1. richvdh commented on Feb 10, 2021

    @richvdh
    MemberAuthor

    (this tends to cause the box to go into swap, which is obviously bad)

  2. benbz commented on Feb 10, 2021

    @benbz
    Contributor

    FYI the media repo's memory profile seem to change after a deploy on 18th Jan:
    image

  3. erikjohnston commented on Feb 11, 2021

    @erikjohnston
    Member

    Previous issue: #8653, though the situation seems to have changed somewhat

  4. added
    S-MinorBlocks non-critical functionality, workarounds exist.
    T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.
    on Feb 11, 2021
  5. added
    S-MajorMajor functionality / product severely impaired, no satisfactory workaround.
    and removed
    S-MinorBlocks non-critical functionality, workarounds exist.
    on Feb 11, 2021
  6. richvdh commented on Feb 11, 2021

    @richvdh
    MemberAuthor

    I don't think it's minor.

  7. michaelkaye commented on Feb 15, 2021

    @michaelkaye
    Contributor

    So we have a tactical cronjob in place on matrix.org for this ; are we going to be able to look into this soon or should we make the automatic restarting more robust?

  8. clokep commented on Feb 16, 2021

    @clokep
    Member

    This might be a regression from #9108 or one of the earlier PRs updating that code.

  9. clokep commented on Feb 16, 2021

    @clokep
    Member

    From @richvdh doing a bit of research:

    it's mostly discovered by introspection of the heap; but treq.client._BufferedResponse is where the response gets buffered in memory

    Looking a bit at this I think setting unbuffered=True on the call to treq.request "fixes" this. I'm not sure of the other ramifications of this though, so looking into that.

  10. self-assigned this
    on Feb 16, 2021
  11. clokep commented on Feb 19, 2021

    @clokep
    Member

    Hopefully the changes in #9421 will help out with this, but I guess it'll be a few days before we know.

  12. clokep commented on Feb 22, 2021

    @clokep
    Member

    After this change it seems that the huge spikes in memory allocation are gone:

    image

    It also seems that nothing is being allocated into gen2 anymore:

    image

    Due to the above I'm going to call this complete. But @richvdh or @benbz please let me know if I'm missing anything here!

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

Metadata

Metadata

Assignees

Labels

S-MajorMajor functionality / product severely impaired, no satisfactory workaround.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions