You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2023/04/05 01:17:15 UTC

[GitHub] [arrow] paleolimbot opened a new issue, #34897: [R][Python] Segfault on session exit after materializing ALTREP character vectors imported from Python

paleolimbot opened a new issue, #34897:
URL: https://github.com/apache/arrow/issues/34897

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   As described and reproduced nicely in https://github.com/rpy2/rpy2-arrow/issues/11
   
   This is almost certainly a result of https://github.com/apache/arrow/pull/34489 since it seems to involve fully materialized arrays. Otherwise, I'm not sure exactly what would cause this specific to shipping arrays over the C Data interface. The traceback reported is below (I will try to reproduce as well):
   
   I suspect this might have to do with the fact that the session shutting down might lead to some things happening with the GIL and R is trying to release that memory at a very inconvenient time.
   
   ```
   Thread 1 "python" received signal SIGSEGV, Segmentation fault.
   0x00005555557868b0 in new_threadstate (interp=0x0, init=1) at ../Python/pystate.c:616
   616	../Python/pystate.c: No such file or directory.
   (gdb) up
   #1  0x00005555557a4ee2 in PyThreadState_New (interp=<optimized out>)
       at ../Python/pystate.c:684
   684	../Python/pystate.c: No such file or directory.
   (gdb) up
   #2  PyGILState_Ensure () at ../Python/pystate.c:1504
   1504	in ../Python/pystate.c
   (gdb) up
   #3  0x00007fffe0ee6003 in arrow::py::NumPyBuffer::~NumPyBuffer() ()
      from /opt/software/python/py310_env/lib/python3.10/site-packages/pyarrow/libarrow_python.so
   (gdb) up
   #4  0x00007fffe0ecb56d in std::_Sp_counted_ptr_inplace<arrow::ArrayData, std::allocator<arrow::ArrayData>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() ()
      from /opt/software/python/py310_env/lib/python3.10/site-packages/pyarrow/libarrow_python.so
   (gdb) up
   #5  0x00007fffe0ecb4d5 in std::_Sp_counted_ptr_inplace<arrow::ArrayData, std::allocator<arrow::ArrayData>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() ()
      from /opt/software/python/py310_env/lib/python3.10/site-packages/pyarrow/libarrow_python.so
   (gdb) up
   #6  0x00007fffde32f04a in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() ()
      from /opt/software/python/py310_env/lib/python3.10/site-packages/pyarrow/libarrow.so.1100
   (gdb) up
   #7  0x00007fffdee02a4c in arrow::(anonymous namespace)::ReleaseExportedArray(ArrowArray*) ()
      from /opt/software/python/py310_env/lib/python3.10/site-packages/pyarrow/libarrow.so.1100
   (gdb) up
   #8  0x00007fffd0aab6f7 in std::_Sp_counted_ptr_inplace<arrow::(anonymous namespace)::ImportedArrayData, std::allocator<arrow::(anonymous namespace)::ImportedArrayData>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() ()
      from /usr/local/packages/R/4.2/lib/R/library/arrow/libs/arrow.so
   (gdb) up
   #9  0x00007fffd04eda4a in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x55555c8b2a70)
       at /usr/include/c++/11/bits/shared_ptr_base.h:168
   168		    _M_dispose();
   (gdb) 
   ```
   
   ### Component(s)
   
   R


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] paleolimbot closed issue #34897: [R][Python] Segfault on session exit after materializing ALTREP character vectors imported from Python

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot closed issue #34897: [R][Python] Segfault on session exit after materializing ALTREP character vectors imported from Python
URL: https://github.com/apache/arrow/issues/34897


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] paleolimbot commented on issue #34897: [R][Python] Segfault on session exit after materializing ALTREP character vectors imported from Python

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #34897:
URL: https://github.com/apache/arrow/issues/34897#issuecomment-1499007140

   Weston pointed me at some code in the Python package that checks if Python is finalizing before attempting to do something that might modify reference counts:
   
   https://github.com/apache/arrow/blob/main/python/pyarrow/src/arrow/python/udf.cc#L52-L58
   
   From the R side, our external pointers have an option to not run the finalizer when the session shuts down ( https://github.com/r-lib/cpp11/blob/main/inst/include/cpp11/external_pointer.hpp#L58 ). We could/should pass `false` here since we aren't using the finalizers to do anything that will have an effect outside the process.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org