Open Tishj opened 1 year ago
I know it's not much of a reproduction, but if you could have a look at the stacktrace and theorycraft why this segfault occurs that would be extremely helpful already.
I can't figure out why PyFrame_GetBack
would segfault here
I think this is related to https://github.com/pybind/pybind11/pull/4863
Unsure if related / this is the same issue, but I can also reproduce it on indentation errors (python 3.11, pybind 2.12.0), here's the stacktrace:
#0 0x00007ffff714a9b0 in ?? () from /usr/lib/libpython3.11.so.1.0
#1 0x00007ffff7146d75 in PyErr_Format () from /usr/lib/libpython3.11.so.1.0
#2 0x00007ffff7136c7f in _PyObject_GenericGetAttrWithDict () from /usr/lib/libpython3.11.so.1.0
#3 0x00007ffff71414cd in PyObject_GetAttr () from /usr/lib/libpython3.11.so.1.0
#4 0x00007ffff71448d6 in PyObject_GetAttrString () from /usr/lib/libpython3.11.so.1.0
#5 0x00005555556d5d78 in pybind11::detail::error_fetch_and_normalize::format_value_and_trace[abi:cxx11]() const (this=0x7fff7c06b5a0)
at /home/mxs/code/neon/deps/pybind11/include/pybind11/pytypes.h:588
#6 0x00005555556d68d6 in pybind11::detail::error_fetch_and_normalize::error_string[abi:cxx11]() const (this=0x7fff7c06b5a0)
at /home/mxs/code/neon/deps/pybind11/include/pybind11/pytypes.h:682
#7 0x00005555556e36d0 in pybind11::error_already_set::what (this=0x7fff7c0628f0) at /home/mxs/code/neon/deps/pybind11/include/pybind11/pybind11.h:2668
And some info about the error:
(gdb) frame 7
#7 0x00005555556e36d0 in pybind11::error_already_set::what (this=0x7fff7c0628f0) at /home/mxs/code/neon/deps/pybind11/include/pybind11/pybind11.h:2668
2668 return m_fetched_error->error_string().c_str();
(gdb) p *m_fetched_error.get()
$3 = {
m_type = {<pybind11::handle> = {<pybind11::detail::object_api<pybind11::handle>> = {<pybind11::detail::pyobject_tag> = {<No data fields>}, <No data fields>}, m_ptr = 0x7ffff745be80}, <No data fields>},
m_value = {<pybind11::handle> = {<pybind11::detail::object_api<pybind11::handle>> = {<pybind11::detail::pyobject_tag> = {<No data fields>}, <No data fields>}, m_ptr = 0x7ffff4024200}, <No data fields>},
m_trace = {<pybind11::handle> = {<pybind11::detail::object_api<pybind11::handle>> = {<pybind11::detail::pyobject_tag> = {<No data fields>}, <No data fields>}, m_ptr = 0x0}, <No data fields>}, m_lazy_error_string = "IndentationError", m_lazy_error_string_completed = false, m_restore_called = false}
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.11.1
Problem description
I run an import of pyarrow and attempt to create a Table from a Pandas DataFrame
this throws an exception, which I catch:
py::error_already_set.what()
causes the segfault.Reproducible example code
I maintain an opensource repo and I absolutely hate it when I get an issue without a reproduction example, but in this case I can't really make one as it's wrapped into an application and only occurs when run together with multiple tests.
(Just running the test where the segfault occurs does not reproduce the issue)
I have however attached lldb and have a stacktrace that hopefully provides more information:
Python version:
Python 3.11.0rc1
(Docker) Linux version:Linux f63acc518afb 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
On Python3.9 the issue is not reproducable