You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "mrd0ll4r (via GitHub)" <gi...@apache.org> on 2025/06/14 13:23:20 UTC

[I] [R] Segfault when executing query on large-ish parquet dataset [arrow]

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

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   Hello, it's me again with big-data R segfaults :)
   
   I have a dataset of approx 8GB, hive-partitioned, `8537` parquet files. I can probably share the dataset.
   
   I'm executing this query:
   ```r
   open_dataset("data/bluesky/labeler_logs_dirty_parquet") %>%
     group_by(uri) %>%
     tally() %>%
     filter(n==1) %>%
     tally() %>%
     collect()
   ```
   
   which throws:
   ```
    *** caught segfault ***
   address 0x7f0634a5e2e8, cause 'memory not mapped'
   
    *** caught segfault ***
   address 0x7f063441a2d5, cause 'memory not mapped'
   
   Traceback:
    1: Table__from_ExecPlanReader(self)
    2: x$read_table()
    3: as_arrow_table.RecordBatchReader(reader)
    4: as_arrow_table(reader)
    5: as_arrow_table.arrow_dplyr_query(x)
    6: as_arrow_table(x)
    7: doTryCatch(return(expr), name, parentenv, handler)
    8: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    9: tryCatchList(expr, classes, parentenv, handlers)Segmentation fault
   ```
   
   Unfortunately, I didn't get a core dump this time, no clue why.
   
   Another query got as far as computing the number of rows and columns, but also segfaulted:
   ```r
   open_dataset("data/bluesky/labeler_logs_dirty_parquet") %>%
     group_by(uri) %>%
     tally() %>%
     collect()
   ```
   ... gets as far as this:
   ```
   # A tibble: 62,642,379 × 2
   ```
   and segfaults like so:
   ```
    *** caught segfault ***
   address 0x7ff004949d34, cause 'memory not mapped'
   
   Traceback:
    1: vec_slice(x, seq_len(n))
    2: vec_head(as.data.frame(x), n)
    3: df_head(x, n)
    4: tbl_format_setup.tbl(x, width, ..., setup = setup, n = n, max_extra_cols = max_extra_cols,     max_footer_lines = max_footer_lines, focus = focus)
    5: tbl_format_setup_dispatch(x, width, ..., setup = setup, n = n,     max_extra_cols = max_extra_cols, max_footer_lines = max_footer_lines,     focus = focus)
    6: tbl_format_setup(x, width = width, ..., setup = setup, n = n,     max_extra_cols = max_extra_cols, max_footer_lines = max_footer_lines,     focus = attr(x, "pillar_focus"))
    7: format_tbl(x, width = width, ..., n = n, max_extra_cols = max_extra_cols,     max_footer_lines = max_footer_lines, transform = writeLines)
    8: print_tbl(x, width, ..., n = n, max_extra_cols = max_extra_cols,     max_footer_lines = max_footer_lines)
    9: print.tbl(x)
   10: (function (x, ...) UseMethod("print"))(x)
   ```
   
   The second crash is less surprising, as that's a giant tibble and R probably doesn't like it.
   But the first query is essentially a scalar, so that should be fine.
   
   The parquet files were originally produced by DuckDB.
   This is the format:
   ```r
   > open_dataset("data/bluesky/labeler_logs_dirty_parquet")
   FileSystemDataset with 8537 Parquet files
   12 columns
   dom: int64
   seq: int64
   ts: timestamp[us, tz=UTC]
   src: string
   neg: bool
   val: string
   uri: string
   cid: string
   ver: int64
   labeler_host: string
   year: int32
   month: int32
   ```
   
   #### Additional Info
   
   Machine overview:
   ```
   Memory: 378 GB
   CPU: 64x Intel(R) Xeon(R) Gold 6154
   OS: Debian 12
   ```
   
   R `sessionInfo()`:
   ```r
   > sessionInfo()
   R version 4.5.0 (2025-04-11)
   Platform: x86_64-pc-linux-gnu
   Running under: Debian GNU/Linux 12 (bookworm)
   
   Matrix products: default
   BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.11.0
   LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.11.0  LAPACK version 3.11.0
   
   locale:
    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
    [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    [9] LC_ADDRESS=C               LC_TELEPHONE=C
   [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
   
   time zone: Europe/Berlin
   tzcode source: system (glibc)
   
   attached base packages:
   [1] stats     graphics  grDevices datasets  utils     methods   base
   
   other attached packages:
    [1] paletteer_1.6.0   ggplot2_3.5.2     viridis_0.6.5     viridisLite_0.4.2
    [5] pracma_2.4.4      xtable_1.8-4      forcats_1.0.0     readr_2.1.5
    [9] arrow_20.0.0      tidyr_1.3.1       stringr_1.5.1     lubridate_1.9.4
   [13] dplyr_1.1.4
   
   loaded via a namespace (and not attached):
    [1] bit_4.6.0          gtable_0.3.6       rematch2_2.1.2     compiler_4.5.0
    [5] renv_1.0.3         tidyselect_1.2.1   parallel_4.5.0     assertthat_0.2.1
    [9] gridExtra_2.3      scales_1.4.0       R6_2.6.1           generics_0.1.4
   [13] tibble_3.3.0       RColorBrewer_1.1-3 pillar_1.10.2      tzdb_0.5.0
   [17] rlang_1.1.6        stringi_1.8.7      bit64_4.6.0-1      timechange_0.3.0
   [21] cli_3.6.5          withr_3.0.2        magrittr_2.0.3     grid_4.5.0
   [25] hms_1.1.3          lifecycle_1.0.4    vctrs_0.6.5        glue_1.8.0
   [29] farver_2.1.2       purrr_1.0.4        tools_4.5.0        pkgconfig_2.0.3
   ```
   
   `lsb_release -a`:
   ```
   No LSB modules are available.
   Distributor ID: Debian
   Description:    Debian GNU/Linux 12 (bookworm)
   Release:        12
   Codename:       bookworm
   ```
   
   `uname -a`:
   ```
   Linux <redacted> 6.1.0-34-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.135-1 (2025-04-25) x86_64 GNU/Linux
   ```
   
   `cat /proc/cpuinfo` (truncated):
   ```
   processor       : 0
   vendor_id       : GenuineIntel
   cpu family      : 6
   model           : 85
   model name      : Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz
   stepping        : 4
   microcode       : 0x2007108
   cpu MHz         : 2992.968
   cache size      : 16384 KB
   physical id     : 0
   siblings        : 64
   core id         : 0
   cpu cores       : 64
   apicid          : 0
   initial apicid  : 0
   fpu             : yes
   fpu_exception   : yes
   cpuid level     : 22
   wp              : yes
   flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat umip pku ospke md_clear flush_l1d arch_capabilities
   vmx flags       : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid shadow_vmcs pml tsc_scaling
   bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa mmio_stale_data retbleed gds bhi ibpb_no_ret
   bogomips        : 5985.93
   clflush size    : 64
   cache_alignment : 64
   address sizes   : 46 bits physical, 48 bits virtual
   power management:
   ```
   
   ### 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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Thanks, and can you also reproduce the crash if you make the dataset smaller (for example by keeping only ~100 Parquet files or so?).


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Sorry, didn't get to do anything yesterday.
   I've reproduced this on the smaller dataset (2.7G, but many more parquet files):
   ```
   > open_dataset("data/bluesky/labeler_logs_clean_parquet") %>% group_by(uri) %>% tally()
   FileSystemDataset (query)
   uri: string
   n: int64
   
   See $.data for the source Arrow object
   > open_dataset("data/bluesky/labeler_logs_clean_parquet") %>% group_by(uri) %>% tally() %>% collect()
   # A tibble: 48,794,031 × 2
   
   Thread 1 "R" received signal SIGSEGV, Segmentation fault.
   std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd08477d26 <error: Cannot access memory at address 0x7ffd08477d26>,
       __last=__last@entry=0x7ffd08477d6c <error: Cannot access memory at address 0x7ffd08477d6c>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   269             operator()(_Iterator __it)
   (gdb) bt
   #0  std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd08477d26 <error: Cannot access memory at address 0x7ffd08477d26>,
       __last=__last@entry=0x7ffd08477d6c <error: Cannot access memory at address 0x7ffd08477d6c>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   #1  0x00007fffeae3edd7 in std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__pred=..., __last=0x7ffd08477d6c <error: Cannot access memory at address 0x7ffd08477d6c>,
       __first=0x7ffd08477d26 <error: Cannot access memory at address 0x7ffd08477d26>) at /usr/include/c++/12/bits/stl_algobase.h:2112
   #2  std::find<char const*, char> (__val=@0x7fffffff4f9f: 0 '\000', __last=0x7ffd08477d6c <error: Cannot access memory at address 0x7ffd08477d6c>,
       __first=0x7ffd08477d26 <error: Cannot access memory at address 0x7ffd08477d26>) at /usr/include/c++/12/bits/stl_algo.h:3851
   #3  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::RStringViewer::Convert (i=0,
       this=0x7fffed4b7940 <arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::string_viewer()::string_viewer>) at altrep.cpp:808
   #4  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Materialize (alt=0x555577947eb8) at altrep.cpp:938
   #5  0x00007fffeae3f089 in arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Dataptr (alt=<optimized out>, writeable=<optimized out>) at altrep.cpp:917
   #6  0x00007ffff7a80aac in ALTVEC_DATAPTR () from /usr/lib/R/lib/libR.so
   #7  0x00007fffee90f3e8 in r_chr_cbegin (x=<optimized out>) at ./rlang/vec.h:50
   #8  chr_slice (x=x@entry=0x555577947eb8, subscript=subscript@entry=0x5555775b80d8, materialize=VCTRS_MATERIALIZE_false) at slice.c:161
   #9  0x00007fffee90f941 in vec_slice_base (type=type@entry=VCTRS_TYPE_character, x=x@entry=0x555577947eb8, subscript=subscript@entry=0x5555775b80d8, materialize=materialize@entry=VCTRS_MATERIALIZE_false)
       at slice.c:255
   #10 0x00007fffee91068b in vec_slice_unsafe (x=x@entry=0x555577947eb8, subscript=subscript@entry=0x5555775b80d8) at slice.c:345
   #11 0x00007fffee91059b in df_slice (subscript=0x5555775b80d8, x=0x55557809ca88) at slice.c:194
   #12 vec_slice_unsafe (x=x@entry=0x55557809ca88, subscript=0x5555775b80d8) at slice.c:359
   #13 0x00007fffee9109cc in vec_slice_opts (x=0x55557809ca88, i=<optimized out>, opts=opts@entry=0x7fffffff51d0) at slice.c:421
   #14 0x00007fffee910a38 in ffi_slice (x=<optimized out>, i=<optimized out>, frame=<optimized out>) at slice.c:406
   #15 0x00007ffff7b02b1e in ?? () from /usr/lib/R/lib/libR.so
   #16 0x00007ffff7b48c24 in ?? () from /usr/lib/R/lib/libR.so
   #17 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #18 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #19 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #20 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #21 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #22 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #23 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #24 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #25 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #26 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #27 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #28 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #29 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #30 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #31 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #32 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #33 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #34 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #35 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #36 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #37 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #38 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #39 0x00007ffff7b508ce in Rf_eval () from /usr/lib/R/lib/libR.so
   #40 0x00007ffff7bc3a28 in ?? () from /usr/lib/R/lib/libR.so
   #41 0x00007ffff7bc7fe2 in ?? () from /usr/lib/R/lib/libR.so
   #42 0x00007ffff7b8a675 in ?? () from /usr/lib/R/lib/libR.so
   #43 0x00007ffff7b8a8d0 in ?? () from /usr/lib/R/lib/libR.so
   #44 0x00007ffff7b8a988 in run_Rmainloop () from /usr/lib/R/lib/libR.so
   #45 0x000055555555507b in main ()
   #46 0x00007ffff784624a in __libc_start_call_main (main=main@entry=0x555555555060 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe1c8) at ../sysdeps/nptl/libc_start_call_main.h:58
   #47 0x00007ffff7846305 in __libc_start_main_impl (main=0x555555555060 <main>, argc=1, argv=0x7fffffffe1c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe1b8)
       at ../csu/libc-start.c:360
   #48 0x00005555555550b1 in _start ()
   ```
   
   does this one also work for you? If so, I can upload the dataset to a server of mine and send you a link. I didn't have any time to see if I can reduce the size of this or pack it into a single parquet file and have it work still, sorry :(
   I tried messaging you on bsky, but that didn't work :( Let me know how I can get the link to you and I'll send it!


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   I've tried to roughly bisect the dataset.
    The original has `8537` parquet file and crashes
   I then randomly remove approximately half of the folders (so as to keep complete datasets per partition) like so:
   ```
   find labeler_logs_dirty_parquet_experiment/ -mindepth 3 -type d  | shuf | head -n 800 | xargs rm -r
   ```
   (the original dataset has about 1600 directories)
   
   `800` directories removed, `4463` parquet files: 
   ```
   [... lots of threads ...]
   # A tibble: 32,729,473 × 2
      uri                                                                        n
      <chr>                                                                  <int>
   [... valid data ...]
   # ℹ 32,729,463 more rows
   # ℹ Use `print(n = ...)` to see more rows
   
   (no crash)
   ```
   
   I restored the dataset to full and removed `400` directories this time.
   `6565` parquet files:
   ```
   [... lots of threads ...]
   # A tibble: 45,518,144 × 2
   
   Thread 1 "R" received signal SIGSEGV, Segmentation fault.
   std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd6c020030 <error: Cannot access memory at address 0x7ffd6c020030>,
       __last=__last@entry=0x7ffd6c020076 <error: Cannot access memory at address 0x7ffd6c020076>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   269             operator()(_Iterator __it)
   
   (gdb) bt
   #0  std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd6c020030 <error: Cannot access memory at address 0x7ffd6c020030>,
       __last=__last@entry=0x7ffd6c020076 <error: Cannot access memory at address 0x7ffd6c020076>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   #1  0x00007fffeae3edd7 in std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__pred=..., __last=0x7ffd6c020076 <error: Cannot access memory at address 0x7ffd6c020076>,
       __first=0x7ffd6c020030 <error: Cannot access memory at address 0x7ffd6c020030>) at /usr/include/c++/12/bits/stl_algobase.h:2112
   #2  std::find<char const*, char> (__val=@0x7fffffff4f9f: 0 '\000', __last=0x7ffd6c020076 <error: Cannot access memory at address 0x7ffd6c020076>,
       __first=0x7ffd6c020030 <error: Cannot access memory at address 0x7ffd6c020030>) at /usr/include/c++/12/bits/stl_algo.h:3851
   #3  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::RStringViewer::Convert (i=17940,
       this=0x7fffed4b7940 <arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::string_viewer()::string_viewer>) at altrep.cpp:808
   #4  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Materialize (alt=0x5555584a4c98) at altrep.cpp:938
   #5  0x00007fffeae3f089 in arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Dataptr (alt=<optimized out>, writeable=<optimized out>) at altrep.cpp:917
   #6  0x00007ffff7a80aac in ALTVEC_DATAPTR () from /usr/lib/R/lib/libR.so
   #7  0x00007fffee90f3e8 in r_chr_cbegin (x=<optimized out>) at ./rlang/vec.h:50
   #8  chr_slice (x=x@entry=0x5555584a4c98, subscript=subscript@entry=0x5555602ee428, materialize=VCTRS_MATERIALIZE_false) at slice.c:161
   #9  0x00007fffee90f941 in vec_slice_base (type=type@entry=VCTRS_TYPE_character, x=x@entry=0x5555584a4c98, subscript=subscript@entry=0x5555602ee428, materialize=materialize@entry=VCTRS_MATERIALIZE_false)
       at slice.c:255
   #10 0x00007fffee91068b in vec_slice_unsafe (x=x@entry=0x5555584a4c98, subscript=subscript@entry=0x5555602ee428) at slice.c:345
   #11 0x00007fffee91059b in df_slice (subscript=0x5555602ee428, x=0x5555636550e8) at slice.c:194
   #12 vec_slice_unsafe (x=x@entry=0x5555636550e8, subscript=0x5555602ee428) at slice.c:359
   #13 0x00007fffee9109cc in vec_slice_opts (x=0x5555636550e8, i=<optimized out>, opts=opts@entry=0x7fffffff51d0) at slice.c:421
   #14 0x00007fffee910a38 in ffi_slice (x=<optimized out>, i=<optimized out>, frame=<optimized out>) at slice.c:406
   #15 0x00007ffff7b02b1e in ?? () from /usr/lib/R/lib/libR.so
   #16 0x00007ffff7b48c24 in ?? () from /usr/lib/R/lib/libR.so
   #17 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #18 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #19 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #20 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #21 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #22 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #23 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #24 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #25 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #26 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #27 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #28 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #29 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #30 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #31 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #32 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #33 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #34 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #35 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #36 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #37 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #38 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #39 0x00007ffff7b508ce in Rf_eval () from /usr/lib/R/lib/libR.so
   #40 0x00007ffff7bc3a28 in ?? () from /usr/lib/R/lib/libR.so
   #41 0x00007ffff7bc7fe2 in ?? () from /usr/lib/R/lib/libR.so
   #42 0x00007ffff7b8a675 in ?? () from /usr/lib/R/lib/libR.so
   #43 0x00007ffff7b8a8d0 in ?? () from /usr/lib/R/lib/libR.so
   #44 0x00007ffff7b8a988 in run_Rmainloop () from /usr/lib/R/lib/libR.so
   #45 0x000055555555507b in main ()
   #46 0x00007ffff784624a in __libc_start_call_main (main=main@entry=0x555555555060 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe1c8) at ../sysdeps/nptl/libc_start_call_main.h:58
   #47 0x00007ffff7846305 in __libc_start_main_impl (main=0x555555555060 <main>, argc=1, argv=0x7fffffffe1c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe1b8)
       at ../csu/libc-start.c:360
   #48 0x00005555555550b1 in _start ()
   ```
   
   
   I restored the dataset to full and removed `600` directories this time.
   `5457` parquet files:
   ```
   [... lots of threads ...]
   # A tibble: 39,279,436 × 2
   
   Thread 1 "R" received signal SIGSEGV, Segmentation fault.
   std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd886760ea <error: Cannot access memory at address 0x7ffd886760ea>,
       __last=__last@entry=0x7ffd88676130 <error: Cannot access memory at address 0x7ffd88676130>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   269             operator()(_Iterator __it)
   (gdb) bt
   #0  std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd886760ea <error: Cannot access memory at address 0x7ffd886760ea>,
       __last=__last@entry=0x7ffd88676130 <error: Cannot access memory at address 0x7ffd88676130>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   #1  0x00007fffeae3edd7 in std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__pred=..., __last=0x7ffd88676130 <error: Cannot access memory at address 0x7ffd88676130>,
       __first=0x7ffd886760ea <error: Cannot access memory at address 0x7ffd886760ea>) at /usr/include/c++/12/bits/stl_algobase.h:2112
   #2  std::find<char const*, char> (__val=@0x7fffffff4f9f: 0 '\000', __last=0x7ffd88676130 <error: Cannot access memory at address 0x7ffd88676130>,
       __first=0x7ffd886760ea <error: Cannot access memory at address 0x7ffd886760ea>) at /usr/include/c++/12/bits/stl_algo.h:3851
   #3  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::RStringViewer::Convert (i=0,
       this=0x7fffed4b7940 <arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::string_viewer()::string_viewer>) at altrep.cpp:808
   #4  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Materialize (alt=0x555557418f38) at altrep.cpp:938
   #5  0x00007fffeae3f089 in arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Dataptr (alt=<optimized out>, writeable=<optimized out>) at altrep.cpp:917
   #6  0x00007ffff7a80aac in ALTVEC_DATAPTR () from /usr/lib/R/lib/libR.so
   #7  0x00007fffee90f3e8 in r_chr_cbegin (x=<optimized out>) at ./rlang/vec.h:50
   #8  chr_slice (x=x@entry=0x555557418f38, subscript=subscript@entry=0x55555ff4c308, materialize=VCTRS_MATERIALIZE_false) at slice.c:161
   #9  0x00007fffee90f941 in vec_slice_base (type=type@entry=VCTRS_TYPE_character, x=x@entry=0x555557418f38, subscript=subscript@entry=0x55555ff4c308, materialize=materialize@entry=VCTRS_MATERIALIZE_false)
       at slice.c:255
   #10 0x00007fffee91068b in vec_slice_unsafe (x=x@entry=0x555557418f38, subscript=subscript@entry=0x55555ff4c308) at slice.c:345
   #11 0x00007fffee91059b in df_slice (subscript=0x55555ff4c308, x=0x555562f38428) at slice.c:194
   #12 vec_slice_unsafe (x=x@entry=0x555562f38428, subscript=0x55555ff4c308) at slice.c:359
   #13 0x00007fffee9109cc in vec_slice_opts (x=0x555562f38428, i=<optimized out>, opts=opts@entry=0x7fffffff51d0) at slice.c:421
   #14 0x00007fffee910a38 in ffi_slice (x=<optimized out>, i=<optimized out>, frame=<optimized out>) at slice.c:406
   #15 0x00007ffff7b02b1e in ?? () from /usr/lib/R/lib/libR.so
   #16 0x00007ffff7b48c24 in ?? () from /usr/lib/R/lib/libR.so
   #17 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #18 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #19 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #20 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #21 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #22 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #23 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #24 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #25 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #26 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #27 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #28 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #29 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #30 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #31 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #32 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #33 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #34 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #35 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #36 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #37 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #38 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #39 0x00007ffff7b508ce in Rf_eval () from /usr/lib/R/lib/libR.so
   #40 0x00007ffff7bc3a28 in ?? () from /usr/lib/R/lib/libR.so
   #41 0x00007ffff7bc7fe2 in ?? () from /usr/lib/R/lib/libR.so
   #42 0x00007ffff7b8a675 in ?? () from /usr/lib/R/lib/libR.so
   #43 0x00007ffff7b8a8d0 in ?? () from /usr/lib/R/lib/libR.so
   #44 0x00007ffff7b8a988 in run_Rmainloop () from /usr/lib/R/lib/libR.so
   #45 0x000055555555507b in main ()
   #46 0x00007ffff784624a in __libc_start_call_main (main=main@entry=0x555555555060 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe1c8) at ../sysdeps/nptl/libc_start_call_main.h:58
   #47 0x00007ffff7846305 in __libc_start_main_impl (main=0x555555555060 <main>, argc=1, argv=0x7fffffffe1c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe1b8)
       at ../csu/libc-start.c:360
   #48 0x00005555555550b1 in _start ()
   ```
   
   
   So it crashes at some point. However, I'm not sure if it's just the size of the dataset or if its some parts of the dataset it doesn't like in particular? I don't have an easy way to get the diff between the two experiments as I removed directories randomly each time, sorry.
   Let me know what you think. I could try digging and remove individual directories one by one, but this would take a while...


-- 
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


Re: [I] [R] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Oh nice, I did that:
   
   ```
   > open_dataset("data/bluesky/labeler_logs_dirty_parquet") %>%
     group_by(uri) %>%
     tally() %>%
     filter(n==1) %>%
     tally() %>%
     collect()
   [New Thread 0x7fffe8c216c0 (LWP 71326)]
   [New Thread 0x7fffe3fff6c0 (LWP 71327)]
   [New Thread 0x7fffe37fe6c0 (LWP 71328)]
   [New Thread 0x7fffe2ffd6c0 (LWP 71329)]
   [New Thread 0x7fffe27fc6c0 (LWP 71330)]
   [New Thread 0x7fffe1ffb6c0 (LWP 71331)]
   [New Thread 0x7fffe17fa6c0 (LWP 71332)]
   [New Thread 0x7fffe0ff96c0 (LWP 71333)]
   [New Thread 0x7fffc3fff6c0 (LWP 71334)]
   [New Thread 0x7fffc37fe6c0 (LWP 71335)]
   [New Thread 0x7fffc2ffd6c0 (LWP 71336)]
   [New Thread 0x7fffc27fc6c0 (LWP 71337)]
   [New Thread 0x7fffc1ffb6c0 (LWP 71338)]
   [New Thread 0x7fffc17fa6c0 (LWP 71339)]
   [New Thread 0x7fffc0ff96c0 (LWP 71340)]
   [New Thread 0x7fffa3fff6c0 (LWP 71341)]
   [New Thread 0x7fff9b7fe6c0 (LWP 71342)]
   [New Thread 0x7fffa37fe6c0 (LWP 71343)]
   [New Thread 0x7fffa2ffd6c0 (LWP 71344)]
   [New Thread 0x7fffa27fc6c0 (LWP 71345)]
   [New Thread 0x7fffa1ffb6c0 (LWP 71346)]
   [New Thread 0x7fffa17fa6c0 (LWP 71347)]
   [New Thread 0x7fffa0ff96c0 (LWP 71348)]
   [New Thread 0x7fff9bfff6c0 (LWP 71349)]
   [New Thread 0x7fff9affd6c0 (LWP 71350)]
   [New Thread 0x7fff9a7fc6c0 (LWP 71351)]
   [New Thread 0x7fff99ffb6c0 (LWP 71352)]
   [New Thread 0x7fff997fa6c0 (LWP 71353)]
   [New Thread 0x7fff98ff96c0 (LWP 71354)]
   [New Thread 0x7fff63fff6c0 (LWP 71355)]
   [New Thread 0x7fff5bfff6c0 (LWP 71356)]
   [New Thread 0x7fff637fe6c0 (LWP 71357)]
   [New Thread 0x7fff62ffd6c0 (LWP 71358)]
   [New Thread 0x7fff627fc6c0 (LWP 71359)]
   [New Thread 0x7fff61ffb6c0 (LWP 71360)]
   [New Thread 0x7fff617fa6c0 (LWP 71361)]
   [New Thread 0x7fff60ff96c0 (LWP 71362)]
   [New Thread 0x7fff5b7fe6c0 (LWP 71363)]
   [New Thread 0x7fff5affd6c0 (LWP 71364)]
   [New Thread 0x7fff5a7fc6c0 (LWP 71365)]
   [New Thread 0x7fff59ffb6c0 (LWP 71366)]
   [New Thread 0x7fff597fa6c0 (LWP 71367)]
   [New Thread 0x7fff58ff96c0 (LWP 71368)]
   [New Thread 0x7fff23fff6c0 (LWP 71369)]
   [New Thread 0x7fff1b7fe6c0 (LWP 71370)]
   [New Thread 0x7fff237fe6c0 (LWP 71373)]
   [New Thread 0x7fff22ffd6c0 (LWP 71374)]
   [New Thread 0x7fff227fc6c0 (LWP 71375)]
   [New Thread 0x7fff21ffb6c0 (LWP 71376)]
   [New Thread 0x7fff217fa6c0 (LWP 71377)]
   [New Thread 0x7fff20ff96c0 (LWP 71378)]
   [New Thread 0x7fff1bfff6c0 (LWP 71379)]
   [New Thread 0x7fff1affd6c0 (LWP 71380)]
   [New Thread 0x7fff1a7fc6c0 (LWP 71381)]
   [New Thread 0x7fff19ffb6c0 (LWP 71382)]
   [New Thread 0x7fff197fa6c0 (LWP 71383)]
   [New Thread 0x7fff18ff96c0 (LWP 71384)]
   [New Thread 0x7ffeebfff6c0 (LWP 71385)]
   [New Thread 0x7ffeeb7fe6c0 (LWP 71386)]
   [New Thread 0x7ffeeaffd6c0 (LWP 71387)]
   [New Thread 0x7ffeea7fc6c0 (LWP 71388)]
   [New Thread 0x7ffee9ffb6c0 (LWP 71389)]
   [New Thread 0x7ffee97fa6c0 (LWP 71390)]
   [New Thread 0x7ffee8ff96c0 (LWP 71391)]
   [New Thread 0x7ffec7fff6c0 (LWP 71392)]
   [New Thread 0x7ffec77fe6c0 (LWP 71393)]
   [New Thread 0x7ffec6ffd6c0 (LWP 71394)]
   [New Thread 0x7ffec67fc6c0 (LWP 71395)]
   [New Thread 0x7ffec5ffb6c0 (LWP 71396)]
   [New Thread 0x7ffec57fa6c0 (LWP 71397)]
   [New Thread 0x7ffec4ff96c0 (LWP 71398)]
   [New Thread 0x7ffea7fff6c0 (LWP 71399)]
   [New Thread 0x7ffea77fe6c0 (LWP 71400)]
   [New Thread 0x7ffea77fe6c0 (LWP 71400)]
   
   Thread 25 "R" received signal SIGSEGV, Segmentation fault.
   [Switching to Thread 0x7fffa17fa6c0 (LWP 71347)]
   __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
   273     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
   (gdb) bt
   #0  __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
   #1  0x00007fffeb76cbfd in memcpy (__len=70, __src=<optimized out>, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:29
   #2  arrow::BufferBuilder::UnsafeAppend (length=70, data=<optimized out>, this=0x7fffa17f89c0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/buffer_builder.h:143
   #3  arrow::TypedBufferBuilder<unsigned char, void>::UnsafeAppend (num_elements=70, values=<optimized out>, this=0x7fffa17f89c0)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/buffer_builder.h:268
   #4  arrow::compute::internal::(anonymous namespace)::BinaryFilterImpl<arrow::BinaryType> (ctx=<optimized out>, out=0x7fff7c036350, null_selection=arrow::compute::FilterOptions::DROP, output_length=26613,
       filter=..., values=...) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/kernels/vector_selection_filter_internal.cc:709
   #5  arrow::compute::internal::(anonymous namespace)::BinaryFilterExec (ctx=<optimized out>, batch=..., out=<optimized out>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/kernels/vector_selection_filter_internal.cc:844
   #6  0x00007fffeb611232 in arrow::compute::detail::(anonymous namespace)::VectorExecutor::Exec (this=this@entry=0x7fff3401de00, span=..., listener=listener@entry=0x7fffa17f8dc0)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1109
   #7  0x00007fffeb611a64 in arrow::compute::detail::(anonymous namespace)::VectorExecutor::Execute (this=0x7fff3401de00, batch=..., listener=0x7fffa17f8dc0)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1049
   #8  0x00007fffeb63233d in arrow::compute::detail::FunctionExecutorImpl::Execute (this=0x7fffcdb6f880, args=std::vector of length 2, capacity 2 = {...}, passed_length=-1)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:278
   #9  0x00007fffeb62ed56 in arrow::compute::(anonymous namespace)::ExecuteInternal (func=..., args=std::vector of length 2, capacity 2 = {...}, passed_length=passed_length@entry=-1,
       options=options@entry=0x7fffa17f97c0, ctx=ctx@entry=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:343
   #10 0x00007fffeb62f297 in arrow::compute::Function::Execute (this=0x55555c117580, args=..., options=0x7fffa17f97c0, ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:350
   #11 0x00007fffeb60dc41 in arrow::compute::CallFunction (func_name="array_filter", args=std::vector of length 2, capacity 2 = {...}, options=options@entry=0x7fffa17f97c0,
       ctx=ctx@entry=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1369
   #12 0x00007fffeb76e071 in arrow::compute::internal::(anonymous namespace)::FilterMetaFunction::ExecuteImpl (this=<optimized out>, args=std::vector of length 2, capacity 2 = {...}, options=0x7fffa17f97c0,
       ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>) at /usr/include/c++/12/bits/basic_string.tcc:238
   #13 0x00007fffeb62dfa7 in arrow::compute::MetaFunction::Execute (this=0x55555910a0e0, args=std::vector of length 2, capacity 2 = {...}, options=0x7fffa17f97c0,
       ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:483
   #14 0x00007fffeb60dc41 in arrow::compute::CallFunction (func_name="filter", args=std::vector of length 2, capacity 2 = {...}, options=options@entry=0x7fffa17f97c0,
       ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>, ctx@entry=0x0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1369
   #15 0x00007fffeb5e8e77 in arrow::compute::Filter (values=..., filter=..., options=..., ctx=ctx@entry=0x0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/api_vector.cc:412
   #16 0x00007fffeb22c37b in arrow::acero::(anonymous namespace)::FilterNode::ProcessBatch (this=<optimized out>, batch=...)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/filter_node.cc:102
   #17 0x00007fffeb23e565 in arrow::acero::MapNode::InputReceived (this=this@entry=0x5555602ecab0, input=input@entry=0x555557f57050, batch=...)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/map_node.cc:76
   #18 0x00007fffeb2d9744 in arrow::acero::aggregate::GroupByNode::OutputNthBatch (this=0x555557f57050, n=1120) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/groupby_aggregate_node.cc:341
   #19 0x00007fffeb2d9883 in operator() (task_id=<optimized out>, __closure=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/groupby_aggregate_node.cc:64
   #20 std::__invoke_impl<arrow::Status, arrow::acero::aggregate::GroupByNode::Init()::<lambda(size_t, int64_t)>&, long unsigned int, long int> (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #21 std::__invoke_r<arrow::Status, arrow::acero::aggregate::GroupByNode::Init()::<lambda(size_t, int64_t)>&, long unsigned int, long int> (__fn=...) at /usr/include/c++/12/bits/invoke.h:116
   #22 std::_Function_handler<arrow::Status(long unsigned int, long int), arrow::acero::aggregate::GroupByNode::Init()::<lambda(size_t, int64_t)> >::_M_invoke(const std::_Any_data &, unsigned long &&, long &&) (
       __functor=..., __args#0=<optimized out>, __args#1=<optimized out>) at /usr/include/c++/12/bits/std_function.h:291
   #23 0x00007fffeb289a7e in std::function<arrow::Status (unsigned long, long)>::operator()(unsigned long, long) const (__args#1=<optimized out>, __args#0=<optimized out>, this=<optimized out>)
       at /usr/include/c++/12/bits/std_function.h:591
   #24 arrow::acero::TaskSchedulerImpl::ExecuteTask (this=0x5555620679e0, thread_id=<optimized out>, group_id=<optimized out>, task_id=<optimized out>, task_group_finished=0x7fffa17f9c16)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/task_util.cc:212
   #25 0x00007fffeb28a2c1 in operator() (__closure=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/task_util.cc:366
   #26 operator() (thread_id=14, __closure=0x7fff5402edc0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/task_util.cc:366
   #27 std::__invoke_impl<arrow::Status, arrow::acero::TaskSchedulerImpl::ScheduleMore(size_t, int)::<lambda(size_t)>&, long unsigned int> (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #28 std::__invoke_r<arrow::Status, arrow::acero::TaskSchedulerImpl::ScheduleMore(size_t, int)::<lambda(size_t)>&, long unsigned int> (__fn=...) at /usr/include/c++/12/bits/invoke.h:116
   #29 std::_Function_handler<arrow::Status(long unsigned int), arrow::acero::TaskSchedulerImpl::ScheduleMore(size_t, int)::<lambda(size_t)> >::_M_invoke(const std::_Any_data &, unsigned long &&) (__functor=...,
       __args#0=<optimized out>) at /usr/include/c++/12/bits/std_function.h:291
   #30 0x00007fffeb24f034 in std::function<arrow::Status (unsigned long)>::operator()(unsigned long) const (__args#0=<optimized out>, this=0x7ffecc01b388) at /usr/include/c++/12/bits/std_function.h:591
   #31 operator() (__closure=0x7ffecc01b380) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/query_context.cc:72
   #32 std::__invoke_impl<arrow::Status, arrow::acero::QueryContext::ScheduleTask(std::function<arrow::Status(long unsigned int)>, std::string_view)::<lambda()>&> (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #33 std::__invoke_r<arrow::Status, arrow::acero::QueryContext::ScheduleTask(std::function<arrow::Status(long unsigned int)>, std::string_view)::<lambda()>&> (__fn=...) at /usr/include/c++/12/bits/invoke.h:116
   #34 std::_Function_handler<arrow::Status(), arrow::acero::QueryContext::ScheduleTask(std::function<arrow::Status(long unsigned int)>, std::string_view)::<lambda()> >::_M_invoke(const std::_Any_data &) (
       __functor=...) at /usr/include/c++/12/bits/std_function.h:291
   #35 0x00007fffeb250e5f in std::function<arrow::Status ()>::operator()() const (this=<optimized out>) at /usr/include/c++/12/bits/std_function.h:591
   #36 arrow::detail::ContinueFuture::operator()<std::function<arrow::Status ()>&, , arrow::Status, arrow::Future<arrow::internal::Empty> >(arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>&) const (this=<optimized out>, f=..., next=...) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/future.h:150
   #37 std::__invoke_impl<void, arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&>(std::__invoke_other, arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&) (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #38 std::__invoke<arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&>(arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&) (__fn=...) at /usr/include/c++/12/bits/invoke.h:96
   #39 std::_Bind<arrow::detail::ContinueFuture (arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (__args=...,
       this=<optimized out>) at /usr/include/c++/12/functional:484
   #40 std::_Bind<arrow::detail::ContinueFuture (arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>)>::operator()<, void>() (this=<optimized out>) at /usr/include/c++/12/functional:567
   #41 arrow::internal::FnOnce<void ()>::FnImpl<std::_Bind<arrow::detail::ContinueFuture (arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>)> >::invoke() (this=<optimized out>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/functional.h:152
   #42 0x00007fffec3e969f in arrow::internal::FnOnce<void ()>::operator()() && (this=0x7fffa17f9d30) at /usr/include/c++/12/bits/unique_ptr.h:191
   #43 arrow::internal::WorkerLoop (it=..., state=...) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/thread_pool.cc:478
   #44 operator() (__closure=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/thread_pool.cc:643
   #45 std::__invoke_impl<void, arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #46 std::__invoke<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > (__fn=...) at /usr/include/c++/12/bits/invoke.h:96
   #47 std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > >::_M_invoke<0> (this=<optimized out>) at /usr/include/c++/12/bits/std_thread.h:252
   #48 std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > >::operator() (this=<optimized out>) at /usr/include/c++/12/bits/std_thread.h:259
   #49 std::thread::_State_impl<std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > > >::_M_run(void) (this=<optimized out>)
       at /usr/include/c++/12/bits/std_thread.h:210
   #50 0x00007ffff4cd44a3 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
   #51 0x00007ffff78a81f5 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
   #52 0x00007ffff792889c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
   ```
   
   I guess if I had a debug build that'd help.. or symbols for some more things.
   Not a debugging expert. Let me know what else I can do!


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Update: I hit this again today, on a different dataset and a different query.
   
   Query:
   ```r
   open_dataset("data/bluesky/labeler_logs_clean_parquet") %>%
     filter(date(ts) <= date("2025-06-14"))
     distinct(uri, src) %>%
     group_by(uri) %>%
     tally() %>%
     filter(n > 1) %>%
     collect() %>%
     pull(uri)
   ```
   
   Dataset:
   ```r
   > open_dataset("data/bluesky/labeler_logs_clean_parquet")
   FileSystemDataset with 54824 Parquet files
   7 columns
   dom: int64
   uri: string
   val: string
   ts: timestamp[us, tz=UTC]
   src: string
   year: int32
   month: int32
   ```
   
   it's a bit smaller:
   ```bash
   $ du -sh data/bluesky/labeler_logs_clean_parquet/
   2.7G    data/bluesky/labeler_logs_clean_parquet/
   ```
   
   Backtrace:
   ```
   Thread 65 "R" received signal SIGSEGV, Segmentation fault.
   [Switching to Thread 0x7ffee5ffb6c0 (LWP 73846)]
   __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
   273     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
   (gdb) bt
   #0  __memcpy_evex_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:273
   #1  0x00007fffeb75ef14 in memcpy (__len=32, __src=<optimized out>, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:29
   #2  arrow::BufferBuilder::UnsafeAppend (length=32, data=<optimized out>, this=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/buffer_builder.h:143
   #3  arrow::TypedBufferBuilder<unsigned char, void>::UnsafeAppend (num_elements=32, values=<optimized out>, this=<optimized out>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/buffer_builder.h:268
   #4  operator() (__closure=__closure@entry=0x7ffee5ff9950, position=2, length=1) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/kernels/vector_selection_filter_internal.cc:565
   #5  0x00007fffeb76bb84 in arrow::internal::VisitSetBitRuns<arrow::compute::internal::(anonymous namespace)::BinaryFilterNonNullImpl<arrow::BinaryType>(arrow::compute::KernelContext*, const arrow::ArraySpan&, const arrow::ArraySpan&, int64_t, arrow::compute::FilterOptions::NullSelectionBehavior, arrow::ArrayData*)::<lambda(int64_t, int64_t)> > (visit=..., length=<optimized out>, offset=<optimized out>,
       bitmap=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/bit_run_reader.h:477
   #6  arrow::compute::internal::(anonymous namespace)::BinaryFilterNonNullImpl<arrow::BinaryType> (ctx=<optimized out>, out=0x7ffec8146350, null_selection=arrow::compute::FilterOptions::DROP, output_length=4020,
       filter=..., values=...) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/kernels/vector_selection_filter_internal.cc:586
   #7  arrow::compute::internal::(anonymous namespace)::BinaryFilterExec (ctx=<optimized out>, batch=..., out=<optimized out>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/kernels/vector_selection_filter_internal.cc:832
   #8  0x00007fffeb611232 in arrow::compute::detail::(anonymous namespace)::VectorExecutor::Exec (this=this@entry=0x7ffec80069f0, span=..., listener=listener@entry=0x7ffee5ff9dc0)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1109
   #9  0x00007fffeb611a64 in arrow::compute::detail::(anonymous namespace)::VectorExecutor::Execute (this=0x7ffec80069f0, batch=..., listener=0x7ffee5ff9dc0)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1049
   #10 0x00007fffeb63233d in arrow::compute::detail::FunctionExecutorImpl::Execute (this=0x7ffec8135d10, args=std::vector of length 2, capacity 2 = {...}, passed_length=-1)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:278
   #11 0x00007fffeb62ed56 in arrow::compute::(anonymous namespace)::ExecuteInternal (func=..., args=std::vector of length 2, capacity 2 = {...}, passed_length=passed_length@entry=-1,
       options=options@entry=0x7ffee5ffa7c0, ctx=ctx@entry=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:343
   #12 0x00007fffeb62f297 in arrow::compute::Function::Execute (this=0x55555bd3b870, args=..., options=0x7ffee5ffa7c0, ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:350
   #13 0x00007fffeb60dc41 in arrow::compute::CallFunction (func_name="array_filter", args=std::vector of length 2, capacity 2 = {...}, options=options@entry=0x7ffee5ffa7c0,
       ctx=ctx@entry=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1369
   #14 0x00007fffeb76e071 in arrow::compute::internal::(anonymous namespace)::FilterMetaFunction::ExecuteImpl (this=<optimized out>, args=std::vector of length 2, capacity 2 = {...}, options=0x7ffee5ffa7c0,
       ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>) at /usr/include/c++/12/bits/basic_string.tcc:238
   #15 0x00007fffeb62dfa7 in arrow::compute::MetaFunction::Execute (this=0x555556c08290, args=std::vector of length 2, capacity 2 = {...}, options=0x7ffee5ffa7c0,
       ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/function.cc:483
   #16 0x00007fffeb60dc41 in arrow::compute::CallFunction (func_name="filter", args=std::vector of length 2, capacity 2 = {...}, options=options@entry=0x7ffee5ffa7c0,
       ctx=0x7fffed4bb420 <arrow::compute::default_exec_context()::default_ctx>, ctx@entry=0x0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/exec.cc:1369
   #17 0x00007fffeb5e8e77 in arrow::compute::Filter (values=..., filter=..., options=..., ctx=ctx@entry=0x0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/compute/api_vector.cc:412
   #18 0x00007fffeb22c37b in arrow::acero::(anonymous namespace)::FilterNode::ProcessBatch (this=<optimized out>, batch=...)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/filter_node.cc:102
   #19 0x00007fffeb23e565 in arrow::acero::MapNode::InputReceived (this=this@entry=0x55555ba9cdd0, input=input@entry=0x55555d630c30, batch=...)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/map_node.cc:76
   #20 0x00007fffeb2d9744 in arrow::acero::aggregate::GroupByNode::OutputNthBatch (this=0x55555d630c30, n=1041) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/groupby_aggregate_node.cc:341
   #21 0x00007fffeb2d9883 in operator() (task_id=<optimized out>, __closure=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/groupby_aggregate_node.cc:64
   #22 std::__invoke_impl<arrow::Status, arrow::acero::aggregate::GroupByNode::Init()::<lambda(size_t, int64_t)>&, long unsigned int, long int> (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #23 std::__invoke_r<arrow::Status, arrow::acero::aggregate::GroupByNode::Init()::<lambda(size_t, int64_t)>&, long unsigned int, long int> (__fn=...) at /usr/include/c++/12/bits/invoke.h:116
   #24 std::_Function_handler<arrow::Status(long unsigned int, long int), arrow::acero::aggregate::GroupByNode::Init()::<lambda(size_t, int64_t)> >::_M_invoke(const std::_Any_data &, unsigned long &&, long &&) (
       __functor=..., __args#0=<optimized out>, __args#1=<optimized out>) at /usr/include/c++/12/bits/std_function.h:291
   #25 0x00007fffeb289a7e in std::function<arrow::Status (unsigned long, long)>::operator()(unsigned long, long) const (__args#1=<optimized out>, __args#0=<optimized out>, this=<optimized out>)
       at /usr/include/c++/12/bits/std_function.h:591
   #26 arrow::acero::TaskSchedulerImpl::ExecuteTask (this=0x55556bf00b20, thread_id=<optimized out>, group_id=<optimized out>, task_id=<optimized out>, task_group_finished=0x7ffee5ffac16)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/task_util.cc:212
   #27 0x00007fffeb28a2c1 in operator() (__closure=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/task_util.cc:366
   #28 operator() (thread_id=52, __closure=0x7fffc81583f0) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/task_util.cc:366
   #29 std::__invoke_impl<arrow::Status, arrow::acero::TaskSchedulerImpl::ScheduleMore(size_t, int)::<lambda(size_t)>&, long unsigned int> (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #30 std::__invoke_r<arrow::Status, arrow::acero::TaskSchedulerImpl::ScheduleMore(size_t, int)::<lambda(size_t)>&, long unsigned int> (__fn=...) at /usr/include/c++/12/bits/invoke.h:116
   #31 std::_Function_handler<arrow::Status(long unsigned int), arrow::acero::TaskSchedulerImpl::ScheduleMore(size_t, int)::<lambda(size_t)> >::_M_invoke(const std::_Any_data &, unsigned long &&) (__functor=...,
       __args#0=<optimized out>) at /usr/include/c++/12/bits/std_function.h:291
   #32 0x00007fffeb24f034 in std::function<arrow::Status (unsigned long)>::operator()(unsigned long) const (__args#0=<optimized out>, this=0x7fffdc007138) at /usr/include/c++/12/bits/std_function.h:591
   #33 operator() (__closure=0x7fffdc007130) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/acero/query_context.cc:72
   #34 std::__invoke_impl<arrow::Status, arrow::acero::QueryContext::ScheduleTask(std::function<arrow::Status(long unsigned int)>, std::string_view)::<lambda()>&> (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #35 std::__invoke_r<arrow::Status, arrow::acero::QueryContext::ScheduleTask(std::function<arrow::Status(long unsigned int)>, std::string_view)::<lambda()>&> (__fn=...) at /usr/include/c++/12/bits/invoke.h:116
   #36 std::_Function_handler<arrow::Status(), arrow::acero::QueryContext::ScheduleTask(std::function<arrow::Status(long unsigned int)>, std::string_view)::<lambda()> >::_M_invoke(const std::_Any_data &) (
       __functor=...) at /usr/include/c++/12/bits/std_function.h:291
   #37 0x00007fffeb250e5f in std::function<arrow::Status ()>::operator()() const (this=<optimized out>) at /usr/include/c++/12/bits/std_function.h:591
   #38 arrow::detail::ContinueFuture::operator()<std::function<arrow::Status ()>&, , arrow::Status, arrow::Future<arrow::internal::Empty> >(arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>&) const (this=<optimized out>, f=..., next=...) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/future.h:150
   #39 std::__invoke_impl<void, arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&>(std::__invoke_other, arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&) (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #40 std::__invoke<arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&>(arrow::detail::ContinueFuture&, arrow::Future<arrow::internal::Empty>&, std::function<arrow::Status ()>&) (__fn=...) at /usr/include/c++/12/bits/invoke.h:96
   #41 std::_Bind<arrow::detail::ContinueFuture (arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) (__args=...,
       this=<optimized out>) at /usr/include/c++/12/functional:484
   #42 std::_Bind<arrow::detail::ContinueFuture (arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>)>::operator()<, void>() (this=<optimized out>) at /usr/include/c++/12/functional:567
   #43 arrow::internal::FnOnce<void ()>::FnImpl<std::_Bind<arrow::detail::ContinueFuture (arrow::Future<arrow::internal::Empty>, std::function<arrow::Status ()>)> >::invoke() (this=<optimized out>)
       at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/functional.h:152
   #44 0x00007fffec3e969f in arrow::internal::FnOnce<void ()>::operator()() && (this=0x7ffee5ffad30) at /usr/include/c++/12/bits/unique_ptr.h:191
   #45 arrow::internal::WorkerLoop (it=..., state=...) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/thread_pool.cc:478
   #46 operator() (__closure=<optimized out>) at /tmp/RtmpvG0xfW/R.INSTALL2875d41805ac1/arrow/tools/cpp/src/arrow/util/thread_pool.cc:643
   #47 std::__invoke_impl<void, arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > (__f=...) at /usr/include/c++/12/bits/invoke.h:61
   #48 std::__invoke<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > (__fn=...) at /usr/include/c++/12/bits/invoke.h:96
   #49 std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > >::_M_invoke<0> (this=<optimized out>) at /usr/include/c++/12/bits/std_thread.h:252
   #50 std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > >::operator() (this=<optimized out>) at /usr/include/c++/12/bits/std_thread.h:259
   #51 std::thread::_State_impl<std::thread::_Invoker<std::tuple<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > > >::_M_run(void) (this=<optimized out>)
       at /usr/include/c++/12/bits/std_thread.h:210
   #52 0x00007ffff4cd44a3 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
   #53 0x00007ffff78a81f5 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
   #54 0x00007ffff792889c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
   ```


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   > does this one also work for you? If so, I can upload the dataset to a server of mine and send you a link. I didn't have any time to see if I can reduce the size of this or pack it into a single parquet file and have it work still, sorry :(
   
   Hopefully it will be fine. Can you please zip the dataset as a single file? You can then send me an e-mail at `pitrou`at`free.fr`. Or, if you prefer, I've just followed you on BlueSky, you should be able to DM me now (you're https://bsky.app/profile/leobalduf.bsky.social, right?).
   
   By the way, I'll be on vacation next week, so please give me some time to download :)


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   I sent you an email. Thanks for looking into this, and no rush!


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   I'm not sure myself as it's deep in the C++ layer, but have updated the ticket label to point it to folks working on that side of things.


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Of course! Although as noted earlier, that's a giant tibble, so the problem here might be with R, not with arrow.
   
   Nonetheless, here it is:
   ```
   .... (I missed a few of these)
   [New Thread 0x7fff82ffd6c0 (LWP 4147274)]
   [New Thread 0x7fff827fc6c0 (LWP 4147275)]
   [New Thread 0x7fff81ffb6c0 (LWP 4147276)]
   [New Thread 0x7fff817fa6c0 (LWP 4147277)]
   [New Thread 0x7fff80ff96c0 (LWP 4147278)]
   [New Thread 0x7fff7b7fe6c0 (LWP 4147279)]
   [New Thread 0x7fff7affd6c0 (LWP 4147280)]
   [New Thread 0x7fff7a7fc6c0 (LWP 4147281)]
   [New Thread 0x7fff79ffb6c0 (LWP 4147282)]
   [New Thread 0x7fff797fa6c0 (LWP 4147283)]
   [New Thread 0x7fff78ff96c0 (LWP 4147284)]
   [New Thread 0x7fff43fff6c0 (LWP 4147285)]
   [New Thread 0x7fff437fe6c0 (LWP 4147286)]
   [New Thread 0x7fff42ffd6c0 (LWP 4147287)]
   [New Thread 0x7fff427fc6c0 (LWP 4147288)]
   [New Thread 0x7fff41ffb6c0 (LWP 4147289)]
   [New Thread 0x7fff417fa6c0 (LWP 4147290)]
   [New Thread 0x7fff40ff96c0 (LWP 4147291)]
   [New Thread 0x7fff23fff6c0 (LWP 4147292)]
   [New Thread 0x7fff237fe6c0 (LWP 4147293)]
   [New Thread 0x7fff22ffd6c0 (LWP 4147294)]
   [New Thread 0x7fff227fc6c0 (LWP 4147295)]
   [New Thread 0x7fff21ffb6c0 (LWP 4147296)]
   [New Thread 0x7fff217fa6c0 (LWP 4147297)]
   [New Thread 0x7fff20ff96c0 (LWP 4147298)]
   [New Thread 0x7fff03fff6c0 (LWP 4147299)]
   [New Thread 0x7ffefb7fe6c0 (LWP 4147300)]
   [New Thread 0x7fff037fe6c0 (LWP 4147301)]
   [New Thread 0x7fff02ffd6c0 (LWP 4147302)]
   [New Thread 0x7fff027fc6c0 (LWP 4147303)]
   [New Thread 0x7fff01ffb6c0 (LWP 4147304)]
   [New Thread 0x7fff017fa6c0 (LWP 4147305)]
   [New Thread 0x7fff00ff96c0 (LWP 4147306)]
   [New Thread 0x7ffefbfff6c0 (LWP 4147307)]
   [New Thread 0x7ffefaffd6c0 (LWP 4147308)]
   [New Thread 0x7ffefa7fc6c0 (LWP 4147309)]
   [New Thread 0x7ffef9ffb6c0 (LWP 4147310)]
   [New Thread 0x7ffef97fa6c0 (LWP 4147311)]
   [New Thread 0x7ffef8ff96c0 (LWP 4147312)]
   [New Thread 0x7ffec3fff6c0 (LWP 4147313)]
   [New Thread 0x7ffec37fe6c0 (LWP 4147314)]
   [New Thread 0x7ffec2ffd6c0 (LWP 4147315)]
   [New Thread 0x7ffec27fc6c0 (LWP 4147316)]
   [New Thread 0x7ffec1ffb6c0 (LWP 4147317)]
   [New Thread 0x7ffec17fa6c0 (LWP 4147318)]
   [New Thread 0x7ffec0ff96c0 (LWP 4147319)]
   [New Thread 0x7ffea3fff6c0 (LWP 4147320)]
   [New Thread 0x7ffea37fe6c0 (LWP 4147321)]
   [Detaching after vfork from child process 4147325]
   # A tibble: 62,642,379 × 2
   
   Thread 1 "R" received signal SIGSEGV, Segmentation fault.
   std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd2d7f40e3 <error: Cannot access memory at address 0x7ffd2d7f40e3>,
       __last=__last@entry=0x7ffd2d7f4103 <error: Cannot access memory at address 0x7ffd2d7f4103>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   269             operator()(_Iterator __it)
   
   (gdb) bt
   #0  std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__first=__first@entry=0x7ffd2d7f40e3 <error: Cannot access memory at address 0x7ffd2d7f40e3>,
       __last=__last@entry=0x7ffd2d7f4103 <error: Cannot access memory at address 0x7ffd2d7f4103>, __pred=__pred@entry=...) at /usr/include/c++/12/bits/predefined_ops.h:269
   #1  0x00007fffeae3edd7 in std::__find_if<char const*, __gnu_cxx::__ops::_Iter_equals_val<char const> > (__pred=..., __last=0x7ffd2d7f4103 <error: Cannot access memory at address 0x7ffd2d7f4103>,
       __first=0x7ffd2d7f40e3 <error: Cannot access memory at address 0x7ffd2d7f40e3>) at /usr/include/c++/12/bits/stl_algobase.h:2112
   #2  std::find<char const*, char> (__val=@0x7fffffff4f9f: 0 '\000', __last=0x7ffd2d7f4103 <error: Cannot access memory at address 0x7ffd2d7f4103>,
       __first=0x7ffd2d7f40e3 <error: Cannot access memory at address 0x7ffd2d7f40e3>) at /usr/include/c++/12/bits/stl_algo.h:3851
   #3  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::RStringViewer::Convert (i=0,
       this=0x7fffed4b7940 <arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::string_viewer()::string_viewer>) at altrep.cpp:808
   #4  arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Materialize (alt=0x55555ac1f228) at altrep.cpp:938
   #5  0x00007fffeae3f089 in arrow::r::altrep::(anonymous namespace)::AltrepVectorString<arrow::StringType>::Dataptr (alt=<optimized out>, writeable=<optimized out>) at altrep.cpp:917
   #6  0x00007ffff7a80aac in ALTVEC_DATAPTR () from /usr/lib/R/lib/libR.so
   #7  0x00007fffee90f3e8 in r_chr_cbegin (x=<optimized out>) at ./rlang/vec.h:50
   #8  chr_slice (x=x@entry=0x55555ac1f228, subscript=subscript@entry=0x55556269a8e8, materialize=VCTRS_MATERIALIZE_false) at slice.c:161
   #9  0x00007fffee90f941 in vec_slice_base (type=type@entry=VCTRS_TYPE_character, x=x@entry=0x55555ac1f228, subscript=subscript@entry=0x55556269a8e8, materialize=materialize@entry=VCTRS_MATERIALIZE_false)
       at slice.c:255
   #10 0x00007fffee91068b in vec_slice_unsafe (x=x@entry=0x55555ac1f228, subscript=subscript@entry=0x55556269a8e8) at slice.c:345
   #11 0x00007fffee91059b in df_slice (subscript=0x55556269a8e8, x=0x5555622282d8) at slice.c:194
   #12 vec_slice_unsafe (x=x@entry=0x5555622282d8, subscript=0x55556269a8e8) at slice.c:359
   #13 0x00007fffee9109cc in vec_slice_opts (x=0x5555622282d8, i=<optimized out>, opts=opts@entry=0x7fffffff51d0) at slice.c:421
   #14 0x00007fffee910a38 in ffi_slice (x=<optimized out>, i=<optimized out>, frame=<optimized out>) at slice.c:406
   #15 0x00007ffff7b02b1e in ?? () from /usr/lib/R/lib/libR.so
   #16 0x00007ffff7b48c24 in ?? () from /usr/lib/R/lib/libR.so
   #17 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #18 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #19 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #20 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #21 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #22 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #23 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #24 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #25 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #26 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #27 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #28 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #29 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #30 0x00007ffff7b54139 in ?? () from /usr/lib/R/lib/libR.so
   #31 0x00007ffff7b9f4e0 in ?? () from /usr/lib/R/lib/libR.so
   #32 0x00007ffff7b9fb5b in ?? () from /usr/lib/R/lib/libR.so
   #33 0x00007ffff7b9fe1f in ?? () from /usr/lib/R/lib/libR.so
   #34 0x00007ffff7b43214 in ?? () from /usr/lib/R/lib/libR.so
   #35 0x00007ffff7b503ca in ?? () from /usr/lib/R/lib/libR.so
   #36 0x00007ffff7b50793 in Rf_eval () from /usr/lib/R/lib/libR.so
   #37 0x00007ffff7b529bf in ?? () from /usr/lib/R/lib/libR.so
   #38 0x00007ffff7b53717 in ?? () from /usr/lib/R/lib/libR.so
   #39 0x00007ffff7b508ce in Rf_eval () from /usr/lib/R/lib/libR.so
   #40 0x00007ffff7bc3a28 in ?? () from /usr/lib/R/lib/libR.so
   #41 0x00007ffff7bc7fe2 in ?? () from /usr/lib/R/lib/libR.so
   #42 0x00007ffff7b8a675 in ?? () from /usr/lib/R/lib/libR.so
   #43 0x00007ffff7b8a8d0 in ?? () from /usr/lib/R/lib/libR.so
   #44 0x00007ffff7b8a988 in run_Rmainloop () from /usr/lib/R/lib/libR.so
   #45 0x000055555555507b in main ()
   #46 0x00007ffff784624a in __libc_start_call_main (main=main@entry=0x555555555060 <main>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe1c8) at ../sysdeps/nptl/libc_start_call_main.h:58
   #47 0x00007ffff7846305 in __libc_start_main_impl (main=0x555555555060 <main>, argc=1, argv=0x7fffffffe1c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe1b8)
       at ../csu/libc-start.c:360
   #48 0x00005555555550b1 in _start ()
   ```
   
   Hope that helps. Let me know if I can do anything else!


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   @pitrou did you get a chance to look at this? Not trying to be pushy, I just guess it'd be nice to tackle this before the version I used is horribly out of date 😬 


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   It definitely seems to be a well-know "kind" of bug - overflow when processing the hash table for aggregation/hash join, though I can't really tell if it is a dup of an existing one.
   
   I assume this is on the latest version of arrow, right? If so, could you share the minimal repro? I'll take a deeper look. Thanks.


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Ok, it looks like all chunks of the group key column (`uri`) are actually slices of a single physical String array. The problem is then the 32-bit offsets of that String array become negative at some point, because the underlying data is too large:
   ```python
   >>> binary_offsets[34170796-5:34170796+5]
   array([ 2147483331,  2147483401,  2147483471,  2147483541,  2147483611,
          -2147483615, -2147483545, -2147483475, -2147483405, -2147483335],
         dtype=int32)
   ```
   
   @zanmato1984 Is this a well-known bug?


-- 
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


Re: [I] [R] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Thanks for reporting this @mrd0ll4r!  Are you able to run R with the debugger attached?  It'll help us narrow down the problem more easily.  There are some instructions here: https://arrow.apache.org/docs/dev/r/articles/developers/debugging.html#running-r-code-with-the-c-debugger-attached


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   > I'll need a link to upload it then :)
   
   Hmm, there are data sharing services out there, though they might have a smaller size cap than what's needed. Is the dataset anonymized enough or do you need to upload it privately for me?


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   Oh, I see! Yes, I can share this. I also hit the same (or very similar) bug on a smaller (2.7G) dataset, but with more parquet files. I'll try to get that as small as possible tomorrow. I'll need a link to upload it then :)
   I can also try collecting all of this into one parquet file, maybe that triggers the bug as well. I'll see how far I get tomorrow.


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   @mrd0ll4r You said the following simpler query also crashed, can you post the C traceback for that?
   ```
   open_dataset("data/bluesky/labeler_logs_dirty_parquet") %>%
     group_by(uri) %>%
     tally() %>%
     collect()
   ```


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   No, I'm mostly interested in a dataset small enough that I can try to reproduce it in debug mode locally, to investigate further (assuming you can shared the dataset publicly?).


-- 
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


Re: [I] [C++] Segfault when executing query on large-ish parquet dataset [arrow]

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

   @mrd0ll4r I'm not sure it's the same thing, but I can reproduce some kind of data corruption from PyArrow:
   ```python
   >>> from pyarrow import dataset as ds
   >>> d = ds.dataset("/home/antoine/arrow/data/issue_46814/labeler_logs_clean_parquet/")
   >>> tab = d.to_table()
   >>> tab.num_rows
   58766107
   >>> tab.validate(full=True)
   
   >>> g = tab.group_by('uri')
   >>> grouped = g.aggregate([])
   >>> grouped.num_rows
   48794031
   >>> grouped.validate(full=True)
   Traceback (most recent call last):
     Cell In[17], line 1
       grouped.validate(full=True)
     File pyarrow/table.pxi:4253 in pyarrow.lib.Table.validate
       check_status(self.table.ValidateFull())
     File pyarrow/error.pxi:92 in pyarrow.lib.check_status
       raise convert_status(status)
   ArrowInvalid: Column 0: In chunk 1023: Invalid: Negative offsets in binary array
   /home/antoine/arrow/dev/cpp/src/arrow/array/validate.cc:168  ValidateBinaryLike(type)
   /home/antoine/arrow/dev/cpp/src/arrow/table.cc:196  ValidateMeta()
   ```


-- 
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