Skip to content

Memory leak in yt's test suite (Python 3.12.0rc1 to 3.12.0rc3) #109602

Closed
@neutrinoceros

Description

@neutrinoceros

Bug report

Bug description:

yt's test suite started crashing when switched to Python 3.12. rc1 was the earliest that we tried, and we're still seeing this with rc3. When run through GitHub Actions, jobs simply exit with Error: the operation was cancelled, and we get no traceback.

It appeared that this crash can only be reproduced on machines with little RAM available, so we tried profiling memory usage.
Here's an illustrative graph, provided by @yut23, of memory usage VS time for a sample of yt's test suite (all third-party packages in the environment are at the same version in both envs)
memory_usage_comparison

Here's an self-contained reproducer script, using memray to trace memory usage

set -euxo pipefail

git clone https://github.com/yt-project/yt --depth=1

python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install -e "./yt[test]"
python -m pip install memray

# setuptools is inspected at runtime in yt's pytest configuration, but it's not needed otherwise
python -m pip install setuptools

cd yt/
python -m memray run -m pytest yt/data_objects

yt uses weakref quite a lot, so we suspect that the issue here might be reminiscent of #108295 (this was pointed out by @Xarthisius).

CPython versions tested on:

3.12

Operating systems tested on:

Linux, macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixesperformancePerformance or resource usagetype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions