-
Notifications
You must be signed in to change notification settings - Fork 22
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
NtScalar give segfault with numpy 1.21.0 #63
Comments
Can you give a bit more information about your environment (OS, version of python, etc.), and perhaps add stacktrace? I cannot reproduce this in my environment: $ conda list numpy # packages in environment at /local/PVAPY/TEST/CONDA: # # Name Version Build Channel numpy 1.21.0 pypi_0 pypi numpy-base 1.20.2 py38hfae3a4d_0 $ conda list pvapy # packages in environment at /local/PVAPY/TEST/CONDA: # # Name Version Build Channel pvapy 3.1.0 py38_1 apsu pvapy-boost 1.72.0 py38_1 apsu $ python -c "from pvapy import *; s = NtScalar(PvInt(3)); print(s)" structure int value 3 |
Hi. Here is the python test in python CLI i did to check on the different PCs:
I am sorry that i cannot provide more. Maybe it is not an issue an dit might just have been a coincidence. python3 version 3.7.3 |
I was able to re-produce this on my (MacOS) machine. The stack trace from that was:
|
As Anders downgraded numpy on the (linux) machine where he encountered the crash, I can not re-produce the stack trace on that machine. However, I can tell you that the location of the crash was the same on that machine. |
I talked to Anders (@Anderspp) and was allowed to update numpy on his machine such that I could get the stack trace. The result was as follows (with use of c++filt):
|
Thanks for the additional info. I managed to reproduce the problem with python 3.7 and numpy 1.21.0. It looks like the boost::python::extract object results in segfault when it is constructed with a dictionary-like object if one is using numpy>=1.21. The proper fix will have to be made in boost python, but in the meantime, I think I have a viable workaround on the branch bp-extract-fix (commit 19d9728). I would appreciate if you could verify the fix in your environment. Here is how I built/tested code from sources, using conda.
$ export TEST_DIR=/local/PVAPY/TEST $ mkdir -p $TEST_DIR $ cd $TEST_DIR $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh $ sh Miniconda3-latest-Linux-x86_64.sh -b -p $PWD/CONDA $ export PATH=$PWD/CONDA/bin:$PATH $ conda install -y python=3.7 $ pip install numpy==1.21 $ conda list python # packages in environment at /local/PVAPY/TEST/CONDA: # # Name Version Build Channel python 3.7.10 hdb3f193_0 $ conda list numpy # packages in environment at /local/PVAPY/TEST/CONDA: # # Name Version Build Channel numpy 1.21.0 pypi_0 pypi
$ git clone git@github.com:epics-base/pvaPy.git pvapy $ cd pvapy $ mkdir -p $TEST_DIR/opt $ PREFIX=$TEST_DIR/opt make local
$ make configure EPICS_BASE=$TEST_DIR/opt/epics-7.0.5 BOOST_ROOT=$TEST_DIR/opt/boost-python-1.72.0 PYTHON_VERSION=3 $ make
bluegill2> source bin/linux-x86_64/pvapy_setup_full.3.7.sh $ python -c "from pvaccess import *; o = NtScalar(INT); print(o)" Segmentation fault (core dumped) $ python -c "from pvaccess import *; o = NtNdArray(); print(o)" Segmentation fault (core dumped)
$ git checkout bp-extract-fix $ make
$ python -c "from pvaccess import *; o = NtScalar(INT); print(o)" epics:nt/NTScalar:1.0 int value 0 string descriptor structure alarm int severity 0 int status 0 string message structure timeStamp long secondsPastEpoch 0 int nanoseconds 0 int userTag 0 structure display double limitLow 0 double limitHigh 0 string description string format string units structure control double limitLow 0 double limitHigh 0 double minStep 0 $ python -c "from pvaccess import *; o = NtNdArray(); print(o)" epics:nt/NTNDArray:1.0 union value (none) structure codec string name any parameters (none) long compressedSize 0 long uncompressedSize 0 structure[] dimension int uniqueId 0 structure dataTimeStamp long secondsPastEpoch 0 int nanoseconds 0 int userTag 0 structure[] attribute string descriptor structure alarm int severity 0 int status 0 string message structure timeStamp long secondsPastEpoch 0 int nanoseconds 0 int userTag 0 structure display double limitLow 0 double limitHigh 0 string description string format string units |
try to uninstall the current NumPy and install NumPy 1.20.3 |
Right, numpy 1.20.x works, but this issue is about 1.21.x. |
Hi, I have a similar problem. Did you open an issue with numpy or boost-python? |
Hi, sorry, I have not had a chance to do this yet. Do you see the problem with latest pvapy packages? Those should be restricting numpy to 1.20.x until this gets resolved. |
Sorry, I was unclear. I see this in my own work. But I only found this thread here with any information. Seems to me to be a problem in either numpy, or boost python. Latest numpy still fail for me (1.21.2). |
It looks like this problem has been corrected in numpy>1.21.5 See boostorg/python#376. In my environment numpy 1.22 works okay. |
I think this issue can be closed. All recent pip/conda packages avoid numpy 1.21 that was causing the problem. |
I just had issues with segfault when using pvapy. In the end (i hope) it turned out that in the installation of pvapy it also installs numpy 1.21.0 and it seem that that version causes a seg fault at least when trying to creeate a pvaccess.NtScalar object.
By reinstalling numpy version 1.20.3 i do not get this issue.
The text was updated successfully, but these errors were encountered: