Skip to content

write_dataset is crashing on my machine #14826

Closed

Description

@LucyMcGowan

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

When I run the following example from the documentation, it seems to crash.

library(arrow)
one_level_tree <- tempfile()
write_dataset(mtcars, one_level_tree, partitioning = "cyl")

This reprex appears to crash R.
See standard output and standard error for more details.

Standard output and error

✖ Install the styler package in order to use `style = TRUE`.

 *** caught illegal operation ***
address 0x11746ec1f, cause 'illegal opcode'

Traceback:
 1: ExecPlan_Write(self, node, prepare_key_value_metadata(node$final_metadata()),     ...)
 2: plan$Write(final_node, options, path_and_fs$fs, path_and_fs$path,     partitioning, basename_template, existing_data_behavior,     max_partitions, max_open_files, max_rows_per_file, min_rows_per_group,     max_rows_per_group)
 3: write_dataset(mtcars, one_level_tree, partitioning = "cyl")
 4: eval(expr, envir, enclos)
 5: eval(expr, envir, enclos)
 6: eval_with_user_handlers(expr, envir, enclos, user_handlers)
 7: withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers))
 8: withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,     message = mHandler)
 9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
13: try(f, silent = TRUE)
14: handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,     message = mHandler))
15: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,     message = mHandler)))
16: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
17: evaluate::evaluate(...)
18: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),     keep_message = !isFALSE(options$message), stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options))
19: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
20: eng_r(options)
21: block_exec(params)
22: call_block(x)
23: process_group.block(group)
24: process_group(group)
25: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        setwd(wd)        cat(res, sep = "\n", file = output %n% "")        message("Quitting from lines ", paste(current_lines(i),             collapse = "-"), " (", knit_concord$get("infile"),             ") ")    })
26: process_file(text, output)
27: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
28: rmarkdown::render(input, quiet = TRUE, envir = globalenv(), encoding = "UTF-8")
29: (function (input) {    rmarkdown::render(input, quiet = TRUE, envir = globalenv(),         encoding = "UTF-8")})(input = base::quote("front-ray_reprex.R"))
30: (function (what, args, quote = FALSE, envir = parent.frame()) {    if (!is.list(args))         stop("second argument must be a list")    if (quote)         args <- lapply(args, enquote)    .Internal(do.call(what, args, envir))})(base::quote(function (input) {    rmarkdown::render(input, quiet = TRUE, envir = globalenv(),         encoding = "UTF-8")}), base::quote(list(input = "front-ray_reprex.R")), envir = base::quote(<environment>),     quote = base::quote(TRUE))
31: do.call(do.call, c(readRDS("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-fun-826a2a4df8"),     list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv,     quote = TRUE)
32: saveRDS(do.call(do.call, c(readRDS("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-fun-826a2a4df8"),     list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv,     quote = TRUE), file = "/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b")
33: withCallingHandlers({    NULL    saveRDS(do.call(do.call, c(readRDS("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-fun-826a2a4df8"),         list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv,         quote = TRUE), file = "/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b")    flush(stdout())    flush(stderr())    NULL    invisible()}, error = function(e) {    {        callr_data <- as.environment("tools:callr")$`__callr_data__`        err <- callr_data$err        assign(".Traceback", .traceback(4), envir = callr_data)        dump.frames("__callr_dump__")        assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data)        rm("__callr_dump__", envir = .GlobalEnv)        e$call <- deparse(conditionCall(e), nlines = 6)        e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e))        class(e2) <- c("callr_remote_error", class(e2))        e2$error <- e        calls <- sys.calls()        dcframe <- which(vapply(calls, function(x) length(x) >=             1 && identical(x[[1]], quote(do.call)), logical(1)))[1]        if (!is.na(dcframe))             e2$`_ignore` <- list(c(1, dcframe + 1L))        e2$`_pid` <- Sys.getpid()        e2$`_timestamp` <- Sys.time()        if (inherits(e, "rlib_error_2_0"))             e2$parent <- e$parent        e2 <- err$add_trace_back(e2, embed = FALSE)        saveRDS(list("error", e2), file = paste0("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b",             ".error"))    }}, interrupt = function(e) {    {        callr_data <- as.environment("tools:callr")$`__callr_data__`        err <- callr_data$err        assign(".Traceback", .traceback(4), envir = callr_data)        dump.frames("__callr_dump__")        assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data)        rm("__callr_dump__", envir = .GlobalEnv)        e$call <- deparse(conditionCall(e), nlines = 6)        e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e))        class(e2) <- c("callr_remote_error", class(e2))        e2$error <- e        calls <- sys.calls()        dcframe <- which(vapply(calls, function(x) length(x) >=             1 && identical(x[[1]], quote(do.call)), logical(1)))[1]        if (!is.na(dcframe))             e2$`_ignore` <- list(c(1, dcframe + 1L))        e2$`_pid` <- Sys.getpid()        e2$`_timestamp` <- Sys.time()        if (inherits(e, "rlib_error_2_0"))             e2$parent <- e$parent        e2 <- err$add_trace_back(e2, embed = FALSE)        saveRDS(list("error", e2), file = paste0("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b",             ".error"))    }}, callr_message = function(e) {    try(signalCondition(e))})
34: doTryCatch(return(expr), name, parentenv, handler)
35: tryCatchOne(expr, names, parentenv, handlers[[1L]])
36: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
37: doTryCatch(return(expr), name, parentenv, handler)
38: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
39: tryCatchList(expr, classes, parentenv, handlers)
40: tryCatch(withCallingHandlers({    NULL    saveRDS(do.call(do.call, c(readRDS("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-fun-826a2a4df8"),         list(envir = .GlobalEnv, quote = TRUE)), envir = .GlobalEnv,         quote = TRUE), file = "/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b")    flush(stdout())    flush(stderr())    NULL    invisible()}, error = function(e) {    {        callr_data <- as.environment("tools:callr")$`__callr_data__`        err <- callr_data$err        assign(".Traceback", .traceback(4), envir = callr_data)        dump.frames("__callr_dump__")        assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data)        rm("__callr_dump__", envir = .GlobalEnv)        e$call <- deparse(conditionCall(e), nlines = 6)        e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e))        class(e2) <- c("callr_remote_error", class(e2))        e2$error <- e        calls <- sys.calls()        dcframe <- which(vapply(calls, function(x) length(x) >=             1 && identical(x[[1]], quote(do.call)), logical(1)))[1]        if (!is.na(dcframe))             e2$`_ignore` <- list(c(1, dcframe + 1L))        e2$`_pid` <- Sys.getpid()        e2$`_timestamp` <- Sys.time()        if (inherits(e, "rlib_error_2_0"))             e2$parent <- e$parent        e2 <- err$add_trace_back(e2, embed = FALSE)        saveRDS(list("error", e2), file = paste0("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b",             ".error"))    }}, interrupt = function(e) {    {        callr_data <- as.environment("tools:callr")$`__callr_data__`        err <- callr_data$err        assign(".Traceback", .traceback(4), envir = callr_data)        dump.frames("__callr_dump__")        assign(".Last.dump", .GlobalEnv$`__callr_dump__`, envir = callr_data)        rm("__callr_dump__", envir = .GlobalEnv)        e$call <- deparse(conditionCall(e), nlines = 6)        e2 <- err$new_error(conditionMessage(e), call. = conditionCall(e))        class(e2) <- c("callr_remote_error", class(e2))        e2$error <- e        calls <- sys.calls()        dcframe <- which(vapply(calls, function(x) length(x) >=             1 && identical(x[[1]], quote(do.call)), logical(1)))[1]        if (!is.na(dcframe))             e2$`_ignore` <- list(c(1, dcframe + 1L))        e2$`_pid` <- Sys.getpid()        e2$`_timestamp` <- Sys.time()        if (inherits(e, "rlib_error_2_0"))             e2$parent <- e$parent        e2 <- err$add_trace_back(e2, embed = FALSE)        saveRDS(list("error", e2), file = paste0("/var/folders/mr/lk15_b411zb85y6q_wwbd_k00000gn/T//Rtmpxx5I9t/callr-res-827f650b3b",             ".error"))    }}, callr_message = function(e) {    try(signalCondition(e))}), error = function(e) {    NULL    try(stop(e))}, interrupt = function(e) {    NULL    e})
An irrecoverable exception occurred. R is aborting now ...
devtools::session_info()
─ Session info ─────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.1.2 (2021-11-01)
 os       macOS Monterey 12.6
 system   x86_64, darwin17.0
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2022-12-02
 rstudio  2022.07.1+554 Spotted Wakerobin (desktop)
 pandoc   2.18 @ /Applications/RStudio.app/Contents/MacOS/quarto/bin/tools/ (via rmarkdown)

─ Packages ─────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 arrow       * 10.0.0  2022-10-26 [1] CRAN (R 4.1.2)
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.1.0)
 backports     1.4.1   2021-12-13 [1] CRAN (R 4.1.0)
 base64url     1.4     2018-05-14 [1] CRAN (R 4.1.0)
 bit           4.0.5   2022-11-15 [1] CRAN (R 4.1.2)
 bit64         4.0.5   2020-08-30 [1] CRAN (R 4.1.0)
 brio          1.1.3   2021-11-30 [1] CRAN (R 4.1.0)
 cachem        1.0.6   2021-08-19 [1] CRAN (R 4.1.0)
 callr         3.7.0   2021-04-20 [1] CRAN (R 4.1.0)
 cli           3.4.1   2022-09-23 [1] CRAN (R 4.1.2)
 clipr         0.7.1   2020-10-08 [1] CRAN (R 4.1.0)
 codetools     0.2-18  2020-11-04 [1] CRAN (R 4.1.2)
 crayon        1.4.2   2021-10-29 [1] CRAN (R 4.1.0)
 data.table    1.14.2  2021-09-27 [1] CRAN (R 4.1.0)
 desc          1.4.0   2021-09-28 [1] CRAN (R 4.1.0)
 devtools      2.4.3   2021-11-30 [1] CRAN (R 4.1.0)
 digest        0.6.29  2021-12-01 [1] CRAN (R 4.1.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
 evaluate      0.15    2022-02-18 [1] CRAN (R 4.1.2)
 fansi         1.0.2   2022-01-14 [1] CRAN (R 4.1.2)
 fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.1.0)
 fs            1.5.2   2021-12-08 [1] CRAN (R 4.1.0)
 future        1.29.0  2022-11-06 [1] CRAN (R 4.1.2)
 globals       0.16.2  2022-11-21 [1] CRAN (R 4.1.2)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.1.2)
 highr         0.9     2021-04-16 [1] CRAN (R 4.1.0)
 htmltools     0.5.2   2021-08-25 [1] CRAN (R 4.1.0)
 igraph        1.2.11  2022-01-04 [1] CRAN (R 4.1.2)
 knitr         1.37    2021-12-16 [1] CRAN (R 4.1.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.1.2)
 listenv       0.8.0   2019-12-05 [1] CRAN (R 4.1.0)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.1.2)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.1.0)
 parallelly    1.32.1  2022-07-21 [1] CRAN (R 4.1.2)
 pillar        1.7.0   2022-02-01 [1] CRAN (R 4.1.2)
 pkgbuild      1.3.1   2021-12-20 [1] CRAN (R 4.1.0)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.1.0)
 pkgload       1.2.4   2021-11-30 [1] CRAN (R 4.1.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.1.0)
 processx      3.5.2   2021-04-30 [1] CRAN (R 4.1.0)
 ps            1.6.0   2021-02-28 [1] CRAN (R 4.1.0)
 purrr         0.3.5   2022-10-06 [1] CRAN (R 4.1.2)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.0)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.1.0)
 reprex        2.0.1   2021-08-05 [1] CRAN (R 4.1.0)
 rlang         1.0.6   2022-09-24 [1] CRAN (R 4.1.2)
 rmarkdown     2.11    2021-09-14 [1] CRAN (R 4.1.0)
 rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.1.0)
 rstudioapi    0.13    2020-11-12 [1] CRAN (R 4.1.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.1.0)
 targets       0.14.1  2022-11-29 [1] CRAN (R 4.1.2)
 testthat      3.1.2   2022-01-20 [1] CRAN (R 4.1.2)
 tibble        3.1.8   2022-07-22 [1] CRAN (R 4.1.2)
 tidyselect    1.2.0   2022-10-10 [1] CRAN (R 4.1.2)
 usethis       2.1.5   2021-12-09 [1] CRAN (R 4.1.0)
 utf8          1.2.2   2021-07-24 [1] CRAN (R 4.1.0)
 vctrs         0.5.1   2022-11-16 [1] CRAN (R 4.1.2)
 withr         2.5.0   2022-03-03 [1] CRAN (R 4.1.2)
 xfun          0.29    2021-12-14 [1] CRAN (R 4.1.0)
 yaml          2.3.4   2022-02-17 [1] CRAN (R 4.1.2)

 [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library

Component(s)

R

Activity

  1. assignUser commented on Dec 5, 2022

    @assignUser
    Member

    This is an issue that sometimes pops up in CI but we have had a hard time to reproduce so far.

    Could you install R 4.2 and try to run the example there?

    If that also errors could you try installing from source (this will also build arrow C++) :

    Sys.setenv(ARROW_R_DEV = TRUE, LIBARROW_BINARY= FALSE, FORCE_BUNDLED_BUILD = TRUE)
    # install deps as binary
    install.packages("arrow")
    remove.packages("arrow")
              
    # install from source
    install.packages("arrow", type = "source")
  2. LucyMcGowan commented on Jan 20, 2023

    @LucyMcGowan
    Author

    Installing the most recent version of R fixed this! Thank you @assignUser -- do you want me to close the issue?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions