-
Notifications
You must be signed in to change notification settings - Fork 91
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
pyfakefs/tests/patched_packages_test.py::TestPatchedPackages::test_read_{csv,table}
fail if zstandard is used with CFFI backend, on Python 3.12
#910
Comments
Thanks for the report! Did you test this also with other Python versions, or only with 3.12? I assume that |
I did with 3.10, 3.11 and PyPy3.10. The issue seems to be specific to 3.12.
Yes, this is the versions I've originally used. The "reproducer" above doesn't install openpyxl at all, the issue happens regardless of whether it's installed or not. I'm pretty sure it's somehow related to CFFI — |
FWICS cffi expects to be able to import It seems that for some reason |
Oh, that's probably because pyfakefs overrides pyfakefs/pyfakefs/fake_filesystem_unittest.py Lines 657 to 659 in 8c7a99c
|
FWICS all Base classes are prefixed with
|
Ah ok - thank you, that makes sense! Is there any possibility to reproduce this in a docker image which uses cffi? I don't know cffi (or gentoo, for that matter), so I'm not sure how I would test that... |
Ok, thinking about this I probably should just use a separate fake wrapper class for |
I will put something together a bit later today. |
I think so. The reproducer I gave above should work in Python3.12 venv anywhere. |
Yes, sorry - I had misread the issue (for some reason thought that a system package was involved). |
- in Python 3.12, _io is not a simple alias for io - fixes pytest-dev#910
- in Python 3.12, _io is not a simple alias for io - fixes pytest-dev#910
- in Python 3.12, _io is not a simple alias for io - fixes #910
@mgorny - shall be fixed in main now, please check! |
It's green now. Thanks!
I don't think there's a need for an urgent release. I don't think this problem is likely to affect many people in the wild, and I've just deselected the two tests from the current version of Gentoo ebuild. |
Ok, in this case I'll wait until something else comes up, thanks! |
FYI: A new patch release is now out. |
Thanks for the ping! I've already added the new version to Gentoo, and ofc I forgot to reenable the test ;-). |
I do not know if it is related but our internal CI is getting OOM killed apparently on a unittest that uses pyfakefs. The memory goes from 1.6GB usage with python 3.11.6 and pyfakefs 5.3.1 to 2.5GB (and OOM killed) with python 3.12.0 and pyfakefs 5.3.2. The container runs on EKS and is based off Ubuntu 22.04. I'm testing various variations to identify the exact test that triggers the memory leak and see if the problem is with the pyfakefs version. |
If it is indeed related to pyfakefs, it should have to do with Python 3.12. There are a few changes in patching (mostly |
@sodul - any luck with finding the cause of the problem or a reproducible example ? If yes, please write a new issue for this. |
@mrbean-bremen I could not get a true root cause unfortunately. One of the issues was that we use EKS (Kubernetes in AWS) and our running nodes switched from cgroup v1 to v2 which meant that we ended up with much larger parallelism than before since v2 does not expose the CPU limits of the container. We hardcoded the parallelism to a reasonable amount, but the memory is still larger than before, but sufficiently under control to no longer get OOM killed. |
One thing I could think of is if you are mapping large files into the fake system and reading them. They will be read into memory at first access and stay there, as long as the fake fs instance lives. Not sure if you are doing something like this, but I can't think of anything else pyfakefs-related that would use noticable amounts of RAM. |
@mrbean-bremen Unfortunately I do not really have much more details. It is possible that some of the files we read are somewhat large, we do have a folder with under 800kB of yaml data loaded by some legacy code we know to be scaling inefficiently, but it hardly explains the increase in memory usage we have noticed. If we do get more specific details we'll make sure to post them here. |
Describe the bug
When the
zstandard
package is using the CFFI backend, the two following tests fail on Python 3.12:How To Reproduce
In a Python 3.12 venv:
Your environment
Reproduced on 8c7a99c.
The text was updated successfully, but these errors were encountered: