Repository navigation
Closed
Labels
Description
Describe the bug, including details regarding any error messages, version, and platform.
https://github.com/apache/arrow/actions/runs/12739705161/job/35503788331?pr=45226
=================================================================
==9882==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 512 byte(s) in 1 object(s) allocated from:
#0 0x55777af7ebed in operator new(unsigned long) (/build/cpp/debug/arrow-dataset-dataset-writer-test+0x419bed) (BuildId: 22e936dc51f9bb18fc25ab7de9ec7c7ba97cc2c2)
#1 0x55777b1376c0 in __gnu_cxx::new_allocator<std::shared_ptr<arrow::RecordBatch> >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:127:27
#2 0x55777b13754c in std::allocator_traits<std::allocator<std::shared_ptr<arrow::RecordBatch> > >::allocate(std::allocator<std::shared_ptr<arrow::RecordBatch> >&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:464:20
#3 0x7f11941d29dc in std::_Deque_base<std::shared_ptr<arrow::RecordBatch>, std::allocator<std::shared_ptr<arrow::RecordBatch> > >::_M_allocate_node() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_deque.h:562:9
#4 0x7f119420bdbd in std::_Deque_base<std::shared_ptr<arrow::RecordBatch>, std::allocator<std::shared_ptr<arrow::RecordBatch> > >::_M_create_nodes(std::shared_ptr<arrow::RecordBatch>**, std::shared_ptr<arrow::RecordBatch>**) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_deque.h:663:21
#5 0x7f119420ae17 in std::_Deque_base<std::shared_ptr<arrow::RecordBatch>, std::allocator<std::shared_ptr<arrow::RecordBatch> > >::_M_initialize_map(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_deque.h:637:4
#6 0x7f119420a2f4 in std::_Deque_base<std::shared_ptr<arrow::RecordBatch>, std::allocator<std::shared_ptr<arrow::RecordBatch> > >::_Deque_base() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_deque.h:439:9
#7 0x7f119420a15f in std::deque<std::shared_ptr<arrow::RecordBatch>, std::allocator<std::shared_ptr<arrow::RecordBatch> > >::deque() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_deque.h:834:7
#8 0x7f1194209e95 in arrow::dataset::internal::(anonymous namespace)::DatasetWriterFileQueue::DatasetWriterFileQueue(std::shared_ptr<arrow::Schema> const&, arrow::dataset::FileSystemDatasetWriteOptions const&, arrow::dataset::internal::(anonymous namespace)::DatasetWriterState*) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:136:12
#9 0x7f1194208165 in std::_MakeUniq<arrow::dataset::internal::(anonymous namespace)::DatasetWriterFileQueue>::__single_object std::make_unique<arrow::dataset::internal::(anonymous namespace)::DatasetWriterFileQueue, std::shared_ptr<arrow::Schema>&, arrow::dataset::FileSystemDatasetWriteOptions const&, arrow::dataset::internal::(anonymous namespace)::DatasetWriterState*&>(std::shared_ptr<arrow::Schema>&, arrow::dataset::FileSystemDatasetWriteOptions const&, arrow::dataset::internal::(anonymous namespace)::DatasetWriterState*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/unique_ptr.h:962:34
#10 0x7f1194206a02 in arrow::dataset::internal::(anonymous namespace)::DatasetWriterDirectoryQueue::OpenFileQueue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:343:9
#11 0x7f119418667a in arrow::dataset::internal::(anonymous namespace)::DatasetWriterDirectoryQueue::StartWrite(std::shared_ptr<arrow::RecordBatch> const&) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:306:7
#12 0x7f119417fcdd in arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::DoWriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:660:27
#13 0x7f119417c5b8 in arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::WriteAndCheckBackpressure(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:539:14
#14 0x7f119417b6ba in arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::WriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::'lambda'()::operator()() /arrow/cpp/src/arrow/dataset/dataset_writer.cc:565:15
#15 0x7f1194179b2b in arrow::util::AsyncTaskScheduler::SimpleTask<arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::WriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::'lambda'()>::operator()() /arrow/cpp/src/arrow/util/async_util.h:153:53
#16 0x7f117fb90b19 in arrow::util::(anonymous namespace)::AsyncTaskGroupImpl::AddTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >)::WrapperTask::operator()() /arrow/cpp/src/arrow/util/async_util.cc:433:9
#17 0x7f117fb7d938 in arrow::util::(anonymous namespace)::ThrottledAsyncTaskSchedulerImpl::SubmitTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >, int, bool)::'lambda'()::operator()() /arrow/cpp/src/arrow/util/async_util.cc:351:11
#18 0x7f117fb7d356 in arrow::util::AsyncTaskScheduler::SimpleTask<arrow::util::(anonymous namespace)::ThrottledAsyncTaskSchedulerImpl::SubmitTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >, int, bool)::'lambda'()>::operator()() /arrow/cpp/src/arrow/util/async_util.h:153:53
#19 0x7f117fb57813 in arrow::util::(anonymous namespace)::AsyncTaskSchedulerImpl::DoSubmitTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >) /arrow/cpp/src/arrow/util/async_util.cc:197:38
#20 0x7f117fb55d31 in arrow::util::(anonymous namespace)::AsyncTaskSchedulerImpl::SubmitTaskUnlocked(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >, std::unique_lock<std::mutex>&&) /arrow/cpp/src/arrow/util/async_util.cc:267:12
#21 0x7f117fb5548d in arrow::util::(anonymous namespace)::AsyncTaskSchedulerImpl::AddTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >) /arrow/cpp/src/arrow/util/async_util.cc:173:5
#22 0x7f117fb7bf9a in bool arrow::util::AsyncTaskScheduler::AddSimpleTask<arrow::util::(anonymous namespace)::ThrottledAsyncTaskSchedulerImpl::SubmitTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >, int, bool)::'lambda'()>(arrow::util::(anonymous namespace)::ThrottledAsyncTaskSchedulerImpl::SubmitTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >, int, bool)::'lambda'(), std::basic_string_view<char, std::char_traits<char> >) /arrow/cpp/src/arrow/util/async_util.h:171:12
#23 0x7f117fb7544b in arrow::util::(anonymous namespace)::ThrottledAsyncTaskSchedulerImpl::SubmitTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >, int, bool) /arrow/cpp/src/arrow/util/async_util.cc:348:21
#24 0x7f117fb7216a in arrow::util::(anonymous namespace)::ThrottledAsyncTaskSchedulerImpl::AddTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >) /arrow/cpp/src/arrow/util/async_util.cc:331:14
#25 0x7f117fb87b6f in arrow::util::(anonymous namespace)::AsyncTaskGroupImpl::AddTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >) /arrow/cpp/src/arrow/util/async_util.cc:446:21
#26 0x7f117fb999f8 in arrow::util::ThrottledAsyncTaskGroup::AddTask(std::unique_ptr<arrow::util::AsyncTaskScheduler::Task, std::default_delete<arrow::util::AsyncTaskScheduler::Task> >) /arrow/cpp/src/arrow/util/async_util.cc:511:25
#27 0x7f119417796a in bool arrow::util::AsyncTaskScheduler::AddSimpleTask<arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::WriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::'lambda'()>(arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::WriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::'lambda'(), std::basic_string_view<char, std::char_traits<char> >) /arrow/cpp/src/arrow/util/async_util.h:171:12
#28 0x7f119416c4cb in arrow::dataset::internal::DatasetWriter::DatasetWriterImpl::WriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:562:19
#29 0x7f119416bdec in arrow::dataset::internal::DatasetWriter::WriteRecordBatch(std::shared_ptr<arrow::RecordBatch>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /arrow/cpp/src/arrow/dataset/dataset_writer.cc:725:17
Component(s)
C++
Activity
wgtmac commentedon Jan 13, 2025
@kou @zanmato1984 Have you seen this? It is not stable to reproduce but I have seen it for several times.
zanmato1984 commentedon Jan 13, 2025
I remember seeing it regularly in the CI jobs of my recent several PRs. Eg. in #45108, https://github.com/apache/arrow/actions/runs/12644487138/job/35232182454?pr=45108
amoeba commentedon Apr 21, 2025
I saw this today in CI for #46180 and was also able to reproduce it locally (debian sid, amd64) once but not after repeated calls.
Edit: I can pretty consistently reproduce the leak on the above system if re-run the test in a while loop.
pitrou commentedon Jun 4, 2025
This seems to be fixed by #46711, though I'm trying to run multiple iterations to confirm.
amoeba commentedon Jun 4, 2025
Since I had a very reliable local reproduction, I tested #46711 I think it's at least way better. I previous could get ASAN to fail within a couple seconds of running,
With your PR, I was able to run that loop for a few minutes but it did hang eventually:
I did manage to get a stack trace,
gdb bt dump
I'll keep trying to reproduce that now.
amoeba commentedon Jun 4, 2025
I didn't reproduce whatever the hang was I reported above so maybe that was just a fluke.
pitrou commentedon Jun 4, 2025
It doesn't seem to be from the right thread, though? Good practice is to use
thread apply all btto get a trace of all threads at the point of crash.Edit: ah, sorry, it was a hang, not a crash. But regardless, without the stack trace from the other threads, it's not possible to understand what could have happened.
amoeba commentedon Jun 4, 2025
Yeah you're right about needing to dump all threads. I'm not in good practice with this stuff apparently. :)
I'll leave it running for a while today to see if I can reproduce the hang.
amoeba commentedon Jun 4, 2025
After about 5 minutes, the test hang again. I then,
thread apply all bt(output included in gist)pitrou commentedon Jun 4, 2025
Did you try to run the test for as long on the main branch?
amoeba commentedon Jun 4, 2025
On the main branch, the test loop fails after just seconds.
Edit: to clarify it's the test loop that fails.
pitrou commentedon Jun 4, 2025
Hmm, that's annoying. We can of course assume that the hang is not a new issue.
amoeba commentedon Jun 4, 2025
Got it. I'll file a new issue for it since different form this one.
pitrou commentedon Jun 5, 2025
I've been running this on an ASAN build of #46711 for the last 30 minutes and I haven't had any failure (yet?):
pitrou commentedon Jun 5, 2025
After almost 90 minutes of running that test in a loop, still no failure.
Edit: still no failure after 3 hours, I'll try to tweak concurrency parameters.
apacheGH-46710: [C++] Fix ownership and lifetime issues in Dataset Wr…
apacheGH-46710: [C++] Fix ownership and lifetime issues in Dataset Wr…