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

Wes McKinney commented on ARROW-4190:
-------------------------------------

[~lishuming] you have many unchecked Status values in your code example. I 
suspect that the segfault is occurring after an error has occurred and not been 
checked

> [C++] memcpy_ssse3_back Segmentation fault
> ------------------------------------------
>
>                 Key: ARROW-4190
>                 URL: https://issues.apache.org/jira/browse/ARROW-4190
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: 0.8.0
>            Reporter: ShuMing Li
>            Priority: Major
>
> Environment:
> {code:java}
> linux amd64
> {code}
>  
> Stack Info:
> {code:java}
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> Core was generated by `/usr/sbin/kudu-tserver 
> --server_dump_info_path=/var/run/hadoop/kudu-tserver-kud'.
> Program terminated with signal 11, Segmentation fault.
> #0 0x00007f8f6cc010d0 in __memcpy_ssse3_back () from /lib64/libc.so.6
> Missing separate debuginfos, use: debuginfo-install 
> cyrus-sasl-lib-2.1.26-19.2.1.alios7.x86_64 
> cyrus-sasl-plain-2.1.26-19.2.1.alios7.x86_64 glibc-2.17-106.alios7.8.x86_64 
> keyutils-libs-1.5.8-3.1.alios7.x86_64 krb5-libs-1.13.2-10.1.alios7.x86_64 
> libcom_err-1.43.5-7.1.alios7.x86_64 libdb-5.3.21-19.1.alios7.x86_64 
> libgcc-4.8.5-4.1.alios7.x86_64 libselinux-2.2.2-6.1.alios7.x86_64 
> libstdc++-4.8.5-4.1.alios7.x86_64 
> nss-softokn-freebl-3.16.2.3-13.1.alios7.x86_64 
> openssl-libs-1.0.1e-52.alios7.5.x86_64 pcre-8.32-15.1.alios7.x86_64 
> xz-libs-5.1.2-12alpha.1.alios7.x86_64 zlib-1.2.7-16.2.alios7.x86_64
> (gdb) bt
> #0 0x00007f8f6cc010d0 in __memcpy_ssse3_back () from /lib64/libc.so.6
> #1 0x0000000001c7f5e7 in arrow::io::BufferReader::Read (this=0x7f8f38f145d0, 
> nbytes=4, bytes_read=0x7f8f38f14120, buffer=<optimized out>)
> at 
> /home/admin/work/kudu/thirdparty/src/apache-arrow-0.8.0/cpp/src/arrow/io/memory.cc:260
> #2 0x0000000001ca7da3 in arrow::ipc::ReadMessage (file=0x7f8f38f145d0, 
> message=0x7f8f38f14400) at 
> /home/admin/work/kudu/thirdparty/src/apache-arrow-0.8.0/cpp/src/arrow/ipc/message.cc:213
> #3 0x0000000001ca92e5 in 
> arrow::ipc::InputStreamMessageReader::ReadNextMessage (this=<optimized out>, 
> message=<optimized out>)
> at 
> /home/admin/work/kudu/thirdparty/src/apache-arrow-0.8.0/cpp/src/arrow/ipc/message.cc:252
> #4 0x0000000001c832d7 in arrow::ipc::ReadMessageAndValidate 
> (reader=<optimized out>, 
> expected_type=expected_type@entry=arrow::ipc::Message::RECORD_BATCH, 
> allow_null=allow_null@entry=true,
> message=message@entry=0x7f8f38f14400) at 
> /home/admin/work/kudu/thirdparty/src/apache-arrow-0.8.0/cpp/src/arrow/ipc/reader.cc:370
> #5 0x0000000001c86c3a in ReadNext (batch=0x7f8f38f14590, this=0x6421760) at 
> /home/admin/work/kudu/thirdparty/src/apache-arrow-0.8.0/cpp/src/arrow/ipc/reader.cc:442
> #6 arrow::ipc::RecordBatchStreamReader::ReadNext (this=<optimized out>, 
> batch=0x7f8f38f14590) at 
> /home/admin/work/kudu/thirdparty/src/apache-arrow-0.8.0/cpp/src/arrow/ipc/reader.cc:496
> {code}
> Code Sample(Just like ipc-read-write-test.cc):
> {code:java}
> // TEST
> std::shared_ptr<arrow::ipc::RecordBatchWriter> writer;
> std::shared_ptr<arrow::PoolBuffer> serialized_buffer = 
> std::make_shared<arrow::PoolBuffer>(arrow::default_memory_pool());
> std::shared_ptr<arrow::io::BufferOutputStream> arrow_stream =
> std::make_shared<arrow::io::BufferOutputStream>(
> serialized_buffer);
> arrow::ipc::RecordBatchStreamWriter::Open(arrow_stream.get(), 
> (*arrow_record_batch)[0]->schema(), &writer);
> int j = 0;
> for (const auto& batch: *arrow_record_batch) {  
>  LOG(INFO) << "start to write batch:" << j++;  
>  writer->WriteRecordBatch(*batch); 
> }
> writer->Close();
> arrow_stream->Close();
> arrow::io::BufferReader buf_reader(serialized_buffer);
> std::shared_ptr<arrow::RecordBatchReader> reader;
> arrow::ipc::RecordBatchStreamReader::Open(&buf_reader, &reader);
> std::shared_ptr<arrow::RecordBatch> chunk;
> int i = 0;
> while (true) {
>   reader->ReadNext(&chunk);
>   LOG(INFO) << "start to handle batch:" << i++ << ", row number:" << 
> chunk->num_rows();
>   if (chunk == nullptr) {     break;   }
> }
> {code}



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

Reply via email to