[ 
https://issues.apache.org/jira/browse/ARROW-3346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16749922#comment-16749922
 ] 

Jarno Seppanen commented on ARROW-3346:
---------------------------------------

I'm seeing this with pyarrow 0.12.0 and pytorch 1.0.0.

Code:

{{import torch}}
{{import pyarrow.parquet as pq}}
{{d = 
pq.read_table('data/train/part-00072-5085765f-c2cb-4669-bf43-815ac1c5e863-c000.snappy.parquet').to_pandas()}}

I got four crashes in five runs:

{{jarno@sp1295:~$ python crash.py }}
{{Segmentation fault (core dumped)}}
{{jarno@sp1295:~$ python crash.py }}
{{Segmentation fault (core dumped)}}
{{jarno@sp1295:~$ python crash.py }}
{{Segmentation fault (core dumped)}}
{{jarno@sp1295:~$ python crash.py }}
{{jarno@sp1295:~$ python crash.py }}
{{Segmentation fault (core dumped)}}

Backtrace:

{{(gdb) bt}}
{{#0 0x00007fffeb589df2 in 
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/torch/lib/libtorch_python.so}}
{{#1 0x00007fffeb589df5 in 
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/torch/lib/libtorch_python.so}}
{{#2 0x00007fffa952c39f in 
parquet::internal::TypedRecordReader<parquet::DataType<(parquet::Type::type)1> 
>::ReadNewPage() ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#3 0x00007fffa9517261 in parquet::internal::RecordReader::ReadRecords(long) 
()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#4 0x00007fffa94feb36 in parquet::arrow::PrimitiveImpl::NextBatch(long, 
std::shared_ptr<arrow::ChunkedArray>*) ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#5 0x00007fffa94f974e in parquet::arrow::ColumnReader::NextBatch(long, 
std::shared_ptr<arrow::ChunkedArray>*) ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#6 0x00007fffa94fbb69 in 
parquet::arrow::FileReader::Impl::ReadSchemaField(int, std::vector<int, 
std::allocator<int> > const&, std::shared_ptr<arrow::ChunkedArray>*) () from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#7 0x00007fffa94fc01e in 
parquet::arrow::FileReader::Impl::ReadTable(std::vector<int, 
std::allocator<int> > const&, 
std::shared_ptr<arrow::Table>*)::\{lambda(int)#1}::operator()(int) const () 
from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#8 0x00007fffa94fc182 in std::_Function_handler<arrow::Status (), 
std::reference_wrapper<std::_Bind_simple<std::reference_wrapper<std::_Bind<parquet::arrow::FileReader::Impl::ReadTable(std::vector<int,
 std::allocator<int> > const&, 
std::shared_ptr<arrow::Table>*)::\{lambda(int)#1} (int)> > ()> > 
>::_M_invoke(std::_Any_data const&) () from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#9 0x00007fffa9895926 in 
std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, 
std::__future_base::_Result_base::_Deleter> (), 
std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<arrow::Status>,
 std::__future_base::_Result_base::_Deleter>, arrow::Status> 
>::_M_invoke(std::_Any_data const&) () from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libarrow_python.so.12}}
{{#10 0x00007fffa9894bbe in 
std::__future_base::_State_base::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base,
 std::__future_base::_Result_base::_Deleter> ()>&, bool&) ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libarrow_python.so.12}}
{{#11 0x00007ffff7bc8a99 in __pthread_once_slow (once_control=0x555556efcaa4, 
init_routine=0x7fffb4510a1c <std::__once_proxy()>)}}
{{ at pthread_once.c:116}}
{{#12 0x00007fffa950041c in 
std::__future_base::_Task_state<std::_Bind<parquet::arrow::FileReader::Impl::ReadTable(std::vector<int,
 std::allocator<int> > const&, 
std::shared_ptr<arrow::Table>*)::\{lambda(int)#1} (int)>, std::allocator<int>, 
arrow::Status ()>::_M_run() ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libparquet.so.12}}
{{#13 0x00007fffa9d197b9 in 
arrow::internal::ThreadPool::WorkerLoop(std::shared_ptr<arrow::internal::ThreadPool::State>,
 std::_List_iterator<std::thread>) () from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libarrow.so.12}}
{{#14 0x00007fffa9d1998b in 
std::thread::_Impl<std::_Bind_simple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::\{lambda()#1}
 ()> >::_M_run() () from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libarrow.so.12}}
{{#15 0x00007fffa9fc1fb0 in execute_native_thread_routine ()}}
{{ from 
/home/jarno/miniconda3/envs/mlbootcamp/lib/python3.6/site-packages/pyarrow/./libarrow.so.12}}
{{#16 0x00007ffff7bc16ba in start_thread (arg=0x7fffa061c700) at 
pthread_create.c:333}}
{{#17 0x00007ffff78f741d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:109}}

> [Python] Segfault when reading parquet files if torch is imported before 
> pyarrow
> --------------------------------------------------------------------------------
>
>                 Key: ARROW-3346
>                 URL: https://issues.apache.org/jira/browse/ARROW-3346
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.10.0
>            Reporter: Alexey Strokach
>            Priority: Major
>
> pyarrow (version 0.10.0) appears to crash sporadically with a segmentation 
> fault when reading parquet files if it is used in a program where torch is 
> imported first.
> A self-contained example is available here: 
> [https://gitlab.com/ostrokach/pyarrow_pytorch_segfault].
> Basically, running
> {{python -X faulthandler -c "import torch; import pyarrow.parquet as pq; _ = 
> pq.ParquetFile('example.parquet').read_row_group(0)"}}
> sooner or later results in a segfault:
> {{Fatal Python error: Segmentation fault}}
> {{Current thread 0x00007f52959bb740 (most recent call first):}}
> {{File 
> "/home/kimlab1/strokach/anaconda/lib/python3.6/site-packages/pyarrow/parquet.py",
>  line 125 in read_row_group}}
>  {{File "<string>", line 1 in <module>}}
>  {{./test_fail.sh: line 5: 42612 Segmentation fault (core dumped) python -X 
> faulthandler -c "import torch; import pyarrow.parquet as pq; _ = 
> pq.ParquetFile('example.parquet').read_row_group(0)"}}
> The number of iterations before a segfault varies, but it usually happens 
> within the first several calls.
> Running
> {{python -X faulthandler -c "import pyarrow.parquet as pq import torch; _ = 
> pq.ParquetFile('example.parquet').read_row_group(0)"}}
> works without a problem.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to