Skip to content

Problem: Storage Service leaks memory #1504

@sevein

Description

@sevein

Expected behaviour
Storage Service's allocated memory should be eventually released. This should be true for both synchronous and asynchronous code paths.

A good initial strategy that we've used in MCPClient is to allow workers to complete only a set amount of jobs. In Gunicorn, we have max_requests and max_requests_jitter. This is just a configuration change, but we'd need to see how it impacts the async manager that the process is running. Gunicorn's worker_exit could be used as a window to exit the worker's watchdog gracefully, but in practice we may never want to do that if the watchdog is busy processing tasks that are blocking. We may have to move the async manager into its own process. At that point the manager will need its own max-tasks-per-child.

Current behaviour
Similar to #1482, we observe that the Gunicorn workers that run Storage Service do not release allocated memory. At a first glance this is also due to how we're using lxml, e.g. parsers setting collect_ids=True by default, and writers not being capable to release.

image

Steps to reproduce

  1. Process multiple transfer in Archivematica.
  2. Observe memory usage.

Your environment (version of Archivematica, operating system, other relevant details)
SS 0.18 and older.


For Artefactual use:

Before you close this issue, you must check off the following:

  • All pull requests related to this issue are properly linked
  • All pull requests related to this issue have been merged
  • A testing plan for this issue has been implemented and passed (testing plan information should be included in the issue body or comments)
  • Documentation regarding this issue has been written and merged (if applicable)
  • Details about this issue have been added to the release notes (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Severity: mediumAn inconvenient situation where the software is usable but inconvenient or slow.Status: refiningThe issue needs additional details to ensure that requirements are clear.Type: bugA flaw in the code that causes the software to produce an incorrect or unexpected result.issue-closure-2025This issue was not addressed in a release, but was closed as part of a blanket issue triage in 2025.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions