Skip to content

[C++][Dataset] Selecting a StringView column ("project") of a Dataset crashes #39639

Closed

Description

@jorisvandenbossche

Describe the bug, including details regarding any error messages, version, and platform.

Using the same dataset created in the top post of #39637:

import pyarrow.dataset as ds
dataset = ds.dataset("test_string_view/", format="ipc")

>>> dataset.schema
Out[26]: 
a: int64
b: string_view

>>> dataset.to_table(columns=["a"])
pyarrow.Table
a: int64
----
a: [[1,2,3]]

>>> dataset.to_table(columns=["b"])
Segmentation fault (core dumped)

So selecting the integer column works fine, but when selecting the string_view column, it crashes.

Component(s)

C++

Activity

  1. jorisvandenbossche commented on Jan 16, 2024

    @jorisvandenbossche
    MemberAuthor

    The GDB backtrace of running the above example:

    Details
    Thread 12 "python" received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0x7fffa6dfe640 (LWP 252895)]
    0x00007ffff542ab55 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x64) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/ext/atomicity.h:50
    50	  { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
    (gdb) bt
    #0  0x00007ffff542ab55 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x64) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/ext/atomicity.h:50
    #1  __gnu_cxx::__exchange_and_add_dispatch (__val=-1, __mem=0x64) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/ext/atomicity.h:84
    #2  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x5c) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/shared_ptr_base.h:155
    #3  0x00007ffff656f4fb in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator= (__r=..., __r=..., this=0x7fff98001f08)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/shared_ptr_base.h:755
    #4  std::__shared_ptr<arrow::Buffer, (__gnu_cxx::_Lock_policy)2>::operator= (this=0x7fff98001f00) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/shared_ptr_base.h:1187
    #5  std::shared_ptr<arrow::Buffer>::operator= (this=0x7fff98001f00) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/shared_ptr.h:358
    #6  arrow::ipc::(anonymous namespace)::BatchDataReadRequest::FulfillRequest (buffers=..., this=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/ipc/reader.cc:154
    #7  arrow::ipc::RecordBatchFileReaderImpl::CachedRecordBatchReadContext::CreateRecordBatch (this=0x7fff98001c60) at /home/joris/scipy/repos/arrow/cpp/src/arrow/ipc/reader.cc:1716
    #8  0x00007ffff656fa58 in arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}::operator()() const (__closure=0x555556b79da8)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/shared_ptr_base.h:1329
    #9  arrow::detail::ContinueFuture::operator()<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}, , arrow::Result<std::shared_ptr<arrow::RecordBatch> >, arrow::Future<std::shared_ptr<arrow::RecordBatch> > >(arrow::Future<std::shared_ptr<arrow::RecordBatch> >, arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}&&) const (this=<optimized out>, f=..., next=...) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:150
    #10 arrow::detail::ContinueFuture::IgnoringArgsIf<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}, arrow::Future<std::shared_ptr<arrow::RecordBatch> >, arrow::internal::Empty const&>(std::integral_constant<bool, true>, arrow::Future<std::shared_ptr<arrow::RecordBatch> >&&, arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}&&, arrow::internal::Empty const&) const (this=<synthetic pointer>, f=..., next=...)
        at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:188
    #11 arrow::Future<arrow::internal::Empty>::ThenOnComplete<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}, arrow::Future<arrow::internal::Empty>::PassthruOnFailure<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}> >::operator()(arrow::Result<arrow::internal::Empty> const&) && (result=..., this=0x555556b79da8) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:545
    #12 arrow::Future<arrow::internal::Empty>::WrapResultOnComplete::Callback<arrow::Future<arrow::internal::Empty>::ThenOnComplete<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}, arrow::Future<arrow::internal::Empty>::PassthruOnFailure<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}> > >::operator()(arrow::FutureImpl const&) && (impl=..., this=0x555556b79da8) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:442
    #13 arrow::internal::FnOnce<void (arrow::FutureImpl const&)>::FnImpl<arrow::Future<arrow::internal::Empty>::WrapResultOnComplete::Callback<arrow::Future<arrow::internal::Empty>::ThenOnComplete<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}, arrow::Future<arrow::internal::Empty>::PassthruOnFailure<arrow::ipc::RecordBatchFileReaderImpl::ReadCachedRecordBatch(int, arrow::Future<std::shared_ptr<arrow::ipc::Message> >)::{lambda(std::shared_ptr<arrow::ipc::Message> const&)#2}::operator()(std::shared_ptr<arrow::ipc::Message> const&) const::{lambda()#1}> > > >::invoke(arrow::FutureImpl const&) (this=0x555556b79da0, a#0=...)
        at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/functional.h:152
    #14 0x00007ffff582b68e in arrow::internal::FnOnce<void (arrow::FutureImpl const&)>::operator()(arrow::FutureImpl const&) && (a#0=..., this=0x7fff98002310)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/unique_ptr.h:172
    #15 arrow::ConcreteFutureImpl::RunOrScheduleCallback (self=..., callback_record=..., in_add_callback=in_add_callback@entry=false) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:110
    #16 0x00007ffff582b9f5 in arrow::ConcreteFutureImpl::DoMarkFinishedOrFailed (this=<optimized out>, state=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:148
    #17 0x00007ffff582bd0a in arrow::ConcreteFutureImpl::DoMarkFinished (this=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:39
    #18 0x00007ffff57bb2e4 in arrow::Future<arrow::internal::Empty>::DoMarkFinished (res=arrow::Result<arrow::internal::Empty>({<No data fields>}), this=0x7fff98002248)
        at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:658
    #19 arrow::Future<arrow::internal::Empty>::MarkFinished<arrow::internal::Empty, void> (this=0x7fff98002248, s=...) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:409
    #20 0x00007ffff582bf35 in operator() (status=..., __closure=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:261
    #21 arrow::Future<arrow::internal::Empty>::WrapStatusyOnComplete::Callback<arrow::AllComplete(const std::vector<arrow::Future<> >&)::<lambda(const arrow::Status&)> >::operator() (impl=..., this=<optimized out>)
        at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:455
    #22 arrow::internal::FnOnce<void(const arrow::FutureImpl&)>::FnImpl<arrow::Future<>::WrapStatusyOnComplete::Callback<arrow::AllComplete(const std::vector<arrow::Future<> >&)::<lambda(const arrow::Status&)> > >::invoke(const arrow::FutureImpl &) (this=0x7fff98002230, a#0=...) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/functional.h:152
    #23 0x00007ffff582b68e in arrow::internal::FnOnce<void (arrow::FutureImpl const&)>::operator()(arrow::FutureImpl const&) && (a#0=..., this=0x7fff98001e10)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/unique_ptr.h:172
    #24 arrow::ConcreteFutureImpl::RunOrScheduleCallback (self=..., callback_record=..., in_add_callback=in_add_callback@entry=false) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:110
    #25 0x00007ffff582b9f5 in arrow::ConcreteFutureImpl::DoMarkFinishedOrFailed (this=<optimized out>, state=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:148
    #26 0x00007ffff582bd0a in arrow::ConcreteFutureImpl::DoMarkFinished (this=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.cc:39
    --Type <RET> for more, q to quit, c to continue without paging--
    #27 0x00007ffff57b9b47 in arrow::Future<std::shared_ptr<arrow::Buffer> >::DoMarkFinished (res=
          arrow::Result<std::shared_ptr<arrow::Buffer>>({<std::__shared_ptr<arrow::Buffer, (__gnu_cxx::_Lock_policy)2>> = {<std::__shared_ptr_access<arrow::Buffer, (__gnu_cxx::_Lock_policy)2, false, false>> = {<No data fields>}, _M_ptr = 0x0, _M_refcount = {_M_pi = 0x0}}, <No data fields>}), this=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:658
    #28 arrow::Future<std::shared_ptr<arrow::Buffer> >::MarkFinished (res=
          arrow::Result<std::shared_ptr<arrow::Buffer>>({<std::__shared_ptr<arrow::Buffer, (__gnu_cxx::_Lock_policy)2>> = {<std::__shared_ptr_access<arrow::Buffer, (__gnu_cxx::_Lock_policy)2, false, false>> = {<No data fields>}, _M_ptr = 0x0, _M_refcount = {_M_pi = 0x0}}, <No data fields>}), this=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:403
    #29 arrow::detail::ContinueFuture::operator()<arrow::io::RandomAccessFile::ReadAsync(const arrow::io::IOContext&, int64_t, int64_t)::<lambda()>&> (this=<optimized out>, f=..., next=...)
        at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/future.h:150
    #30 std::__invoke_impl<void, arrow::detail::ContinueFuture&, arrow::Future<std::shared_ptr<arrow::Buffer> >&, arrow::io::RandomAccessFile::ReadAsync(const arrow::io::IOContext&, int64_t, int64_t)::<lambda()>&>
        (__f=...) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/invoke.h:60
    #31 std::__invoke<arrow::detail::ContinueFuture&, arrow::Future<std::shared_ptr<arrow::Buffer> >&, arrow::io::RandomAccessFile::ReadAsync(const arrow::io::IOContext&, int64_t, int64_t)::<lambda()>&> (__fn=...)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/invoke.h:95
    #32 std::_Bind<arrow::detail::ContinueFuture(arrow::Future<std::shared_ptr<arrow::Buffer> >, arrow::io::RandomAccessFile::ReadAsync(const arrow::io::IOContext&, int64_t, int64_t)::<lambda()>)>::__call<void, 0, 1> (__args=..., this=<optimized out>) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/functional:416
    #33 std::_Bind<arrow::detail::ContinueFuture(arrow::Future<std::shared_ptr<arrow::Buffer> >, arrow::io::RandomAccessFile::ReadAsync(const arrow::io::IOContext&, int64_t, int64_t)::<lambda()>)>::operator()<> (
        this=<optimized out>) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/functional:499
    #34 arrow::internal::FnOnce<void()>::FnImpl<std::_Bind<arrow::detail::ContinueFuture(arrow::Future<std::shared_ptr<arrow::Buffer> >, arrow::io::RandomAccessFile::ReadAsync(const arrow::io::IOContext&, int64_t, int64_t)::<lambda()>)> >::invoke(void) (this=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/functional.h:152
    #35 0x00007ffff5860aa9 in arrow::internal::FnOnce<void ()>::operator()() && (this=0x7fffa6dfddc0) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/unique_ptr.h:172
    #36 arrow::internal::WorkerLoop (it=..., state=...) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/thread_pool.cc:457
    #37 operator() (__closure=<optimized out>) at /home/joris/scipy/repos/arrow/cpp/src/arrow/util/thread_pool.cc:618
    #38 std::__invoke_impl<void, arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > (__f=...) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/invoke.h:60
    #39 std::__invoke<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > (__fn=...) at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/bits/invoke.h:95
    #40 std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > >::_M_invoke<0> (this=<optimized out>)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/thread:264
    #41 std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > >::operator() (this=<optimized out>)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/thread:271
    #42 std::thread::_State_impl<std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > > >::_M_run(void) (this=<optimized out>)
        at /home/joris/miniconda3/envs/arrow-dev/x86_64-conda-linux-gnu/include/c++/10.4.0/thread:215
    #43 0x00007ffff5020a93 in std::execute_native_thread_routine (__p=<optimized out>) at ../../../../../libstdc++-v3/src/c++11/thread.cc:82
    #44 0x00007ffff7d12ac3 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
    #45 0x00007ffff7da4850 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
    
  2. thisisnic commented on Nov 10, 2026

    @thisisnic
    Member

    I'm just going through older bug issues to see if we can close them out or we need further action.

    Could not reproduce on 26.0.1. Appears to have been fixed in #48925.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions