-
Notifications
You must be signed in to change notification settings - Fork 38
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
Possible memory leak beginning with 4.1.5 #147
Comments
I can replicate this in a conda environment using different p4p versions through pip with numpy 1.26.42. With 4.1.4, I see initial high cpu usage that then drops, with low memory usage. 4.1.12 sees similar CPU performance, with memory slowly increasing similar to the above diagram. The increasing line is python 3.9, p4p==4.1.12; the flat line is p4p==4.1.4 |
Can Also, could you try my from p4p.disect import periodic
periodic(1.0, sys.stderr) Each second eg.
|
Here is the output from a run that uses the 4.1.12 configuration. I can add PVXS debug logging, but I'm not sure if it would add much.
|
I think one needs to decorate methods inside your code base to make |
This is unsurprising. On the C++ side, these allocations are tracked by the Another builtin diagnostic is |
Also, could you run the P4P unittests for each configuration? |
I am able to replicate this leak. I think I see what is going on. cf. epics-base/pvxs#71 |
@mdavidsaver Thanks for looking into that! |
I think that epics-base/pvxs#77 plugs this leak. @azukov @jeinstei Can you confirm? |
It's a bit unclear how to do it. pip install git+https://github.com/mdavidsaver/pvxs.git@330097b7d455fbae689c890e5b5fef1a59d885e7
pip install p4p==4.1.12 First command ran fine but the second gave conflict with EPICS base:
|
I think you want
However, you might also need to use a If you find that PIP is ruining your friday, you could instead try: https://epics-base.github.io/p4p/building.html#build-as-epics-module. Then end with |
Looks like the problem is in pvxs pyproject.toml that insists on having specific version of epicscorelibs if I remove specific version it works. Here is how I tested it. pip install --no-cache-dir "numpy<2" memory_profiler
pip install --no-cache-dir epicscorelibs
git clone -b fix_cache_sync --recursive https://github.com/mdavidsaver/pvxs-dev.git Remove specific version and build/install pvxs and p4p sed -i 's/\bepicscorelibs[^"]*/epicscorelibs/' pvxs-dev/pyproject.toml
pip install --no-cache-dir pvxs-dev/
pip install --no-cache-dir p4p==4.1.12 Run test mprof run -o patch.dat client.py Switch to previous commit 1ca7600a2b5322a and run test again cd pvxs-dev
git checkout 1ca7600a2b5322a
pip install --no-cache-dir pvxs-dev/
mprof run -o no_patch.dat client.py So the patch you provided seems to fix the bug, thanks a lot! |
The client seems to have memory leak when running with Python3.9 on Linux.
The problem started with 4.1.5 and still present in 4.1.12, version 4.1.4 is OK.
Everything is installed with
pip install -r requirements.txt
from PyPi.Tested with
mprof run client.py
whilepython server.py
is running as a separate process.Tested configurations
requirements.txt with X being specific version
server.py
client.py
The results of memory usage are:
The text was updated successfully, but these errors were encountered: