Skip to content
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

pybind11: Should ensure that python3.8-dbg doesn't cause segfault on Linux? #14740

Closed
EricCousineau-TRI opened this issue Mar 4, 2021 · 4 comments · Fixed by RobotLocomotion/pybind11#52
Assignees
Labels

Comments

@EricCousineau-TRI
Copy link
Contributor

EricCousineau-TRI commented Mar 4, 2021

When doing RobotLocomotion/pybind11#47, I realized that both that PR and the current version of RobotLocomotion/pybind11 segfaults in CPython 3.8.0 debug build on Linux. (Surprised we didn't see it with Mac, but oh well... could be due to it being older 3.8.0)

The following code fails on our newest version of the fork, but not on upstream.

cd pybind11
sudo apt install python3.8-dev python3.8-venv python3.8-dbg

do-build() { (
set -eux;
python_bin=${1}
mode=${2}

git clean -fxd  # WARNING!
${python_bin} -m venv ./venv
source ./venv/bin/activate
pip install -U pip wheel
pip install pytest numpy
mkdir build && cd build
cmake .. -GNinja \
    -DCMAKE_BUILD_TYPE=${mode} \
    -DPYTHON_EXECUTABLE=$(which python)
ninja pytest
) }

# Release
do-build python3.8 Release
# Debug
do-build python3.8-dbg Debug

Segfault info:

python: ../Objects/typeobject.c:3121: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed.
Aborted (core dumped)

Upstream:

Fork:

Note that the above PR (47) makes things pass in non-debug mode, but still fails otherwise.

Should check w/ later CPython 3.8.x versions too.

@EricCousineau-TRI EricCousineau-TRI added type: bug priority: medium component: pydrake Python API and its supporting Starlark macros labels Mar 4, 2021
@EricCousineau-TRI EricCousineau-TRI self-assigned this Mar 4, 2021
@EricCousineau-TRI EricCousineau-TRI changed the title pybind11: Should ensure that python3.8 and python3.8-dbg doesn't cause segfault on Linux? pybind11: Should ensure that python3.8-dbg doesn't cause segfault on Linux? Mar 4, 2021
@EricCousineau-TRI
Copy link
Contributor Author

EricCousineau-TRI commented Mar 5, 2021

Er... now I'm super confused, b/c above stuff indicates that pybind/pybind11@1caf1d0 fails on CPython 3.8.0? (meaning I did something in our fork, like a cherry-pick or a similar change, that came in later?)

Nvm. Just seems like I introduced a regression in our fork that un-fixed pybind/pybind11#2685 (or found a new edge case)

FYI @jamiesnape

@EricCousineau-TRI
Copy link
Contributor Author

EricCousineau-TRI commented Mar 5, 2021

Narrowed it test_eigen.cpp on latest commit:

cd pybind11
(
cd ./build/tests && \
    gdb -batch -ex 'r' -ex 'bt' --args \
    ../../venv/bin/python -m pytest \
    ../../tests/test_eigen.py
) 2>&1 | tee /tmp/output.txt

https://gist.github.com/EricCousineau-TRI/a60c2ba37eb7db04c183f5be81a267b0

@EricCousineau-TRI
Copy link
Contributor Author

Meta - what does team: kitware mean in this case?

@EricCousineau-TRI
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants