Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to use_version() crashes R session #1868

Closed
LDalby opened this issue Jun 22, 2023 · 12 comments
Closed

Call to use_version() crashes R session #1868

LDalby opened this issue Jun 22, 2023 · 12 comments

Comments

@LDalby
Copy link

LDalby commented Jun 22, 2023

Calling use_version(), then selecting one of the options will crash my R session. Before the 💣 it will update the DESCRIPTION file with the new version number, so perhaps it is related to updating the NEWS.md?
Has worked like a charm for me for a long time.
I have no clue how to debug this. Any hints would be much welcome!

use_version()

Created on 2023-06-22 with reprex v2.0.2

Session info
session_info()
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.2 (2022-10-31)
 os       macOS Ventura 13.4.1
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Copenhagen
 date     2023-06-22
 rstudio  2023.06.0+421 Mountain Hydrangea (desktop)
 pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 bit           4.0.5   2022-11-15 [1] CRAN (R 4.2.0)
 bit64         4.0.5   2020-08-30 [1] CRAN (R 4.2.0)
 blob          1.2.4   2023-03-17 [1] CRAN (R 4.2.0)
 cachem        1.0.8   2023-05-01 [1] CRAN (R 4.2.0)
 callr         3.7.3   2022-11-02 [1] CRAN (R 4.2.0)
 cli           3.6.1   2023-03-23 [1] CRAN (R 4.2.0)
 clipr         0.8.0   2022-02-22 [1] CRAN (R 4.2.0)
 crayon        1.5.2   2022-09-29 [1] CRAN (R 4.2.0)
 DBI           1.1.3   2022-06-18 [1] CRAN (R 4.2.0)
 dbplyr        2.3.2   2023-03-21 [1] CRAN (R 4.2.0)
 devtools    * 2.4.5   2022-10-11 [1] CRAN (R 4.2.0)
 digest        0.6.31  2022-12-11 [1] CRAN (R 4.2.0)
 dplyr         1.1.2   2023-04-20 [1] CRAN (R 4.2.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.2.0)
 evaluate      0.21    2023-05-05 [1] CRAN (R 4.2.0)
 fansi         1.0.4   2023-01-22 [1] CRAN (R 4.2.0)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.2.0)
 fs            1.6.2   2023-04-25 [1] CRAN (R 4.2.0)
 generics      0.1.3   2022-07-05 [1] CRAN (R 4.2.0)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.2.0)
 hms           1.1.3   2023-03-21 [1] CRAN (R 4.2.0)
 htmltools     0.5.5   2023-03-23 [1] CRAN (R 4.2.0)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.2.0)
 httpuv        1.6.11  2023-05-11 [1] CRAN (R 4.2.0)
 knitr         1.43    2023-05-25 [1] CRAN (R 4.2.0)
 later         1.3.1   2023-05-02 [1] CRAN (R 4.2.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.2.0)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.0)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.2.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.2.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.2.0)
 odbc          1.3.4   2023-01-17 [1] CRAN (R 4.2.0)
 pillar        1.9.0   2023-03-22 [1] CRAN (R 4.2.0)
 pkgbuild      1.4.1   2023-06-14 [1] CRAN (R 4.2.0)
 pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.2.0)
 pkgload       1.3.2   2022-11-16 [1] CRAN (R 4.2.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.2.0)
 processx      3.8.1   2023-04-18 [1] CRAN (R 4.2.0)
 profvis       0.3.8   2023-05-02 [1] CRAN (R 4.2.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.2.0)
 ps            1.7.5   2023-04-18 [1] CRAN (R 4.2.0)
 purrr         1.0.1   2023-01-10 [1] CRAN (R 4.2.0)
 R.cache       0.16.0  2022-07-21 [1] CRAN (R 4.2.0)
 R.methodsS3   1.8.2   2022-06-13 [1] CRAN (R 4.2.0)
 R.oo          1.25.0  2022-06-12 [1] CRAN (R 4.2.0)
 R.utils       2.12.2  2022-11-11 [1] CRAN (R 4.2.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.0)
 Rcpp          1.0.10  2023-01-22 [1] CRAN (R 4.2.0)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.2.0)
 reprex        2.0.2   2022-08-17 [1] CRAN (R 4.2.0)
 rlang         1.1.1   2023-04-28 [1] CRAN (R 4.2.0)
 rmarkdown     2.22    2023-06-01 [1] CRAN (R 4.2.0)
 rstudioapi    0.14    2022-08-22 [1] CRAN (R 4.2.1)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.0)
 shiny         1.7.4   2022-12-15 [1] CRAN (R 4.2.0)
 stringi       1.7.12  2023-01-11 [1] CRAN (R 4.2.0)
 stringr       1.5.0   2022-12-02 [1] CRAN (R 4.2.0)
 styler        1.10.1  2023-06-05 [1] CRAN (R 4.2.0)
 tibble        3.2.1   2023-03-20 [1] CRAN (R 4.2.0)
 tidyselect    1.2.0   2022-10-10 [1] CRAN (R 4.2.0)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.2.0)
 usethis     * 2.2.0   2023-06-06 [1] CRAN (R 4.2.0)
 utf8          1.2.3   2023-01-31 [1] CRAN (R 4.2.0)
 vctrs         0.6.3   2023-06-14 [1] CRAN (R 4.2.0)
 withr         2.5.0   2022-03-03 [1] CRAN (R 4.2.0)
 xfun          0.39    2023-04-20 [1] CRAN (R 4.2.0)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.2.0)
 yaml          2.3.7   2023-01-23 [1] CRAN (R 4.2.0)

 [1] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@jennybc
Copy link
Member

jennybc commented Jun 22, 2023

I can't reproduce this, so I suspect it's due to something else wonky about your system.

> packageVersion("usethis")
[1] '2.2.0'
> use_version()
✔ Setting active project to '/Users/jenny/rrr/gmailr'
Current version is 1.0.1.9000.
What should the new version be? (0 to exit) 

1: major --> 2.0.0
2: minor --> 1.1.0
3: patch --> 1.0.2
4:   dev --> 1.0.1.9001

Selection: 3
✔ Adding '1.0.2' to Version
✔ Replacing development heading in NEWS.md
There are 2 uncommitted files:
* 'DESCRIPTION'
* 'NEWS.md'
Is it ok to commit them?

1: Not now
2: Nope
3: Yes

Selection: 2

@jennybc jennybc closed this as completed Jun 22, 2023
@LDalby
Copy link
Author

LDalby commented Jun 22, 2023

I hope it is alright that I post on this issue although it has been closed. Just in case somebody else runs into a similar issue in the future.

Following @gaborcsardi suggestion on Mastodon, I called use_version from the command line which allowed me to capture the stack trace:

> usethis::use_version(which = "dev")
✔ Adding '0.1.5.9002' to Version

 *** caught segfault ***
address 0x72617262694c2f27, cause 'invalid permissions'

Traceback:
 1: .Primitive(".Call")(list(name = "map_impl", address = <pointer: 0x1336b51d0>,     dll = list(name = "purrr", path = "/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/purrr/libs/purrr.so",         dynamicLookup = FALSE, handle = <pointer: 0x910c2f20>,         info = <pointer: 0x13366a080>), numParameters = 6L),     <environment>, "logical", FALSE, 1L, NULL, 0L)
 2: call_with_cleanup(map_impl, environment(), .type, .progress,     n, names, i)
 3: withCallingHandlers(expr, error = function(cnd) {    if (i == 0L) {    }    else {        message <- c(i = "In index: {i}.")        if (!is.null(names) && !is.na(names[[i]]) && names[[i]] !=             "") {            name <- names[[i]]            message <- c(message, i = "With name: {name}.")        }        else {            name <- NULL        }        cli::cli_abort(message, location = i, name = name, parent = cnd,             call = error_call, class = "purrr_error_indexed")    }})
 4: with_indexed_errors(i = i, names = names, error_call = .purrr_error_call,     call_with_cleanup(map_impl, environment(), .type, .progress,         n, names, i))
 5: map_("logical", .x, .f, ..., .progress = .progress)
 6: map_lgl(dots, has_absolute_path)
 7: proj_path("NEWS.md")
 8: use_news_heading("(development version)")
 9: usethis::use_version(which = "dev")

@LDalby
Copy link
Author

LDalby commented Jun 23, 2023

To get the stack trace from C I follow these steps provided by @gaborcsardi:

  1. Run R like this: R -q -d lldb
  2. Then type 'run' + ENTER and run the R code. When it crashes, you'll be at the lldb prompt.
  3. Type 'bt' there, or 'bt 10' if 'bt' output is too long.

Below I insert the output from typing bt in step 3):

> usethis::use_version(which="dev")
✔ Setting active project to '/Users/au206907/Documents/debugpak'
✔ Adding '0.0.0.9002' to Version
Process 3536 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x206f6e2820276269)
    frame #0: 0x00000001004c5bd8 libR.dylib`Rf_findVarInFrame3(rho=0x206f6e2820276269, symbol=0x0000000105a1e5e8, doGet=TRUE) at envir.c:1003:9 [opt]
Target 0: (R) stopped.
warning: libR.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x206f6e2820276269)
  * frame #0: 0x00000001004c5bd8 libR.dylib`Rf_findVarInFrame3(rho=0x206f6e2820276269, symbol=0x0000000105a1e5e8, doGet=TRUE) at envir.c:1003:9 [opt]
    frame #1: 0x00000001004c6184 libR.dylib`Rf_findVarInFrame(rho=<unavailable>, symbol=<unavailable>) at envir.c:1101:12 [opt] [artificial]
    frame #2: 0x0000000100432bac libR.dylib`get_package_CEntry_table(package=<unavailable>) at Rdynload.c:1566:12 [opt]
    frame #3: 0x0000000100432c60 libR.dylib`R_GetCCallable(package="cli", name="cli_progress_bar") at Rdynload.c:1588:17 [opt]
    frame #4: 0x0000000100c5d4e8 purrr.so`call_loop [inlined] cli_progress_bar(total=1, config=<unavailable>) at progress.h:293:45 [opt]
    frame #5: 0x0000000100c5d4c8 purrr.so`call_loop(env=0x0000000105a6d890, call=0x0000000105a59c48, type=10, progress=0x0000000103d4d8e8, n=1, names=0x000000010180b6e0, p_i=0x0000000103d48408, force=1) at map.c:29:14 [opt]
    frame #6: 0x00000001004adb64 libR.dylib`R_doDotCall(ofun=<unavailable>, nargs=6, cargs=0x000000016fdf6898, call=0x0000000105a59858) at dotcode.c:617:17 [opt]
    frame #7: 0x00000001004ae4fc libR.dylib`do_dotcall(call=0x0000000105a59858, op=<unavailable>, args=<unavailable>, env=<unavailable>) at dotcode.c:1284:11 [opt]
    frame #8: 0x00000001004dc928 libR.dylib`Rf_eval(e=0x0000000105a59858, rho=0x0000000105a6d890) at eval.c:851:9 [opt]
    frame #9: 0x0000000100c5b7d8 purrr.so`with_cleanup_context_wrap(data=0x000000016fdf6f50) at cleancall.c:117:14 [opt]
    frame #10: 0x0000000100498f4c libR.dylib`R_ExecWithCleanup(fun=(purrr.so`with_cleanup_context_wrap at cleancall.c:115), data=<unavailable>, cleanfun=(purrr.so`call_exits at cleancall.c:90), cleandata=0x000000016fdf6f50) at context.c:884:5 [opt]
    frame #11: 0x0000000100c5b5cc purrr.so`cleancall_call [inlined] r_with_cleanup_context(fn=<unavailable>, data=0x000000016fdf6f40) at cleancall.c:133:14 [opt]
    frame #12: 0x0000000100c5b56c purrr.so`cleancall_call(args=<unavailable>, env=<unavailable>) at cleancall.c:60:14 [opt]
    frame #13: 0x00000001004ad60c libR.dylib`R_doDotCall(ofun=<unavailable>, nargs=2, cargs=<unavailable>, call=0x0000000105a5c038) at dotcode.c:604:17 [opt]
    frame #14: 0x00000001004f621c libR.dylib`bcEval(body=0x0000000105a5bf90, rho=<unavailable>, useCache=<unavailable>) at eval.c:7692:21 [opt]
    frame #15: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a5bf90, rho=0x0000000105a5c770) at eval.c:748:8 [opt]
    frame #16: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000105a72a48, newrho=0x0000000105a5c770, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #17: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000105a72a48, op=0x0000000105a5bb68, arglist=0x0000000105a5c2d8, rho=0x0000000105a6d890, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #18: 0x00000001004e36b0 libR.dylib`bcEval(body=0x0000000105a6d1c8, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #19: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a6d1c8, rho=0x0000000105a6d890) at eval.c:748:8 [opt]
    frame #20: 0x00000001004f7a24 libR.dylib`forcePromise(e=0x0000000105a5b2a8) at eval.c:568:8 [opt]
    frame #21: 0x0000000100503938 libR.dylib`getvar [inlined] FORCE_PROMISE(value=0x0000000105a5b2a8, symbol=0x0000000101019f50, rho=0x0000000105a5b3f8, keepmiss=FALSE) at eval.c:5157:15 [opt]
    frame #22: 0x0000000100503930 libR.dylib`getvar(symbol=0x0000000101019f50, rho=0x0000000105a5b3f8, dd=<unavailable>, keepmiss=FALSE, vcache=<unavailable>, sidx=<unavailable>) at eval.c:5198:14 [opt]
    frame #23: 0x00000001004e0a90 libR.dylib`bcEval(body=0x0000000105a5d9a8, rho=<unavailable>, useCache=<unavailable>) at eval.c:6888:20 [opt]
    frame #24: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a5d9a8, rho=0x0000000105a5b3f8) at eval.c:748:8 [opt]
    frame #25: 0x00000001004f7a24 libR.dylib`forcePromise(e=0x0000000105a5b430) at eval.c:568:8 [opt]
    frame #26: 0x0000000100503938 libR.dylib`getvar [inlined] FORCE_PROMISE(value=0x0000000105a5b430, symbol=0x0000000101019f50, rho=0x0000000105a5b5b8, keepmiss=FALSE) at eval.c:5157:15 [opt]
    frame #27: 0x0000000100503930 libR.dylib`getvar(symbol=0x0000000101019f50, rho=0x0000000105a5b5b8, dd=<unavailable>, keepmiss=FALSE, vcache=<unavailable>, sidx=<unavailable>) at eval.c:5198:14 [opt]
    frame #28: 0x00000001004e0a90 libR.dylib`bcEval(body=0x000000010383ee88, rho=<unavailable>, useCache=<unavailable>) at eval.c:6888:20 [opt]
    frame #29: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x000000010383ee88, rho=0x0000000105a5b5b8) at eval.c:748:8 [opt]
    frame #30: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000105a625e8, newrho=0x0000000105a5b5b8, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #31: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000105a625e8, op=0x000000010383ede0, arglist=0x0000000105a5b468, rho=0x0000000105a5b3f8, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #32: 0x00000001004e36b0 libR.dylib`bcEval(body=0x0000000105a62540, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #33: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a62540, rho=0x0000000105a5b3f8) at eval.c:748:8 [opt]
    frame #34: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000105a72930, newrho=0x0000000105a5b3f8, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #35: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000105a72930, op=0x0000000105a620e0, arglist=0x0000000105a5b190, rho=0x0000000105a6d890, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #36: 0x00000001004e36b0 libR.dylib`bcEval(body=0x0000000105a72070, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #37: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a72070, rho=0x0000000105a6d890) at eval.c:748:8 [opt]
    frame #38: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000105a74498, newrho=0x0000000105a6d890, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #39: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000105a74498, op=0x0000000105a719a8, arglist=0x0000000105a6d580, rho=0x0000000105a717e8, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #40: 0x00000001004e36b0 libR.dylib`bcEval(body=0x0000000105a743b8, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #41: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a743b8, rho=0x0000000105a717e8) at eval.c:748:8 [opt]
    frame #42: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000105a76e00, newrho=0x0000000105a717e8, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #43: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000105a76e00, op=0x0000000105a73cb8, arglist=0x0000000105a71660, rho=0x0000000105a73a50, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #44: 0x00000001004e36b0 libR.dylib`bcEval(body=0x0000000105a767e0, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #45: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a767e0, rho=0x0000000105a73a50) at eval.c:748:8 [opt]
    frame #46: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000105a7a6c8, newrho=0x0000000105a73a50, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #47: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000105a7a6c8, op=0x0000000105a76428, arglist=0x0000000105a73970, rho=0x0000000105a762d8, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #48: 0x00000001004e36b0 libR.dylib`bcEval(body=0x0000000105a7a508, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #49: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x0000000105a7a508, rho=0x0000000105a762d8) at eval.c:748:8 [opt]
    frame #50: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000103829fc8, newrho=0x0000000105a762d8, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #51: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000103829fc8, op=0x0000000105a7a188, arglist=0x0000000105a76268, rho=0x00000001038274a0, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #52: 0x00000001004e36b0 libR.dylib`bcEval(body=0x000000010382ecb0, rho=<unavailable>, useCache=<unavailable>) at eval.c:7104:12 [opt]
    frame #53: 0x00000001004dc4c8 libR.dylib`Rf_eval(e=0x000000010382ecb0, rho=0x00000001038274a0) at eval.c:748:8 [opt]
    frame #54: 0x00000001004f9ad4 libR.dylib`R_execClosure(call=0x0000000103b387a0, newrho=0x00000001038274a0, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #55: 0x00000001004f830c libR.dylib`Rf_applyClosure(call=0x0000000103b387a0, op=0x0000000103832130, arglist=0x00000001038273f8, rho=0x0000000101844ac8, suppliedvars=<unavailable>) at eval.c:1844:16 [opt]
    frame #56: 0x00000001004dc79c libR.dylib`Rf_eval(e=0x0000000103b387a0, rho=0x0000000101844ac8) at eval.c:871:12 [opt]
    frame #57: 0x000000010052ecbc libR.dylib`Rf_ReplIteration(rho=0x0000000101844ac8, savestack=<unavailable>, browselevel=<unavailable>, state=0x000000016fdfe270) at main.c:262:2 [opt]
    frame #58: 0x00000001005302ac libR.dylib`R_ReplConsole(rho=0x0000000101844ac8, savestack=0, browselevel=0) at main.c:314:11 [opt]
    frame #59: 0x00000001005301e4 libR.dylib`run_Rmainloop at main.c:1137:5 [opt]
    frame #60: 0x0000000100530390 libR.dylib`Rf_mainloop at main.c:1144:5 [opt]
    frame #61: 0x0000000100003ea0 R`main + 32
    frame #62: 0x000000019e4c7f28 dyld`start + 2236

@gaborcsardi
Copy link
Member

This seems like some binary incompatibility between any two of R, cli and purrr.

Unfortunately I still cannot reproduce it with the exact same OS version, R version and package versions. :(

A long shot, but can you try reinstalling cli and purrr? First from binaries, and then from source:

install.packages(c("cli", "purrr"), type = "source")

@gaborcsardi
Copy link
Member

gaborcsardi commented Jun 24, 2023

@LDalby If that does not work, some questions.

How did you install R? Do you have other R versions installed?

Can you try with R --vanilla? If that works, then can you show what you have in your .Renviron and .Rprofile files? (Make sure to remove sensitive information first!)

Also, did you load any packages using devtools::load_all() or pkgload::load_all()?

@LDalby
Copy link
Author

LDalby commented Jun 27, 2023

@gaborcsardi Thanks for these suggestions also. I will investigate further and report back.
Travelling at the moment, so it will not be until later this week.

@LDalby
Copy link
Author

LDalby commented Jun 27, 2023

I installed R by going to r-project.org and downloaded the installer. I only have R 4.2.2 installed on this machine.
I will get the crash in a completely fresh R session, so without any calls to devtools::load_all() or pkgload::load_all().

I have now tried to first reinstall {cli} and {purrr} from binaries, then from source neither solved the issue.

Starting R from a terminal using R --vanilla resulted in:

> use_version(which="dev")
✔ Setting active project to '/Users/au206907/git/naturdata/naturdata'
✔ Adding '0.1.5.9006' to Version

 *** caught segfault ***
address 0x72617262694c2f27, cause 'invalid permissions'

Traceback:
 1: .Primitive(".Call")(list(name = "map_impl", address = <pointer: 0x14bf340a0>,     dll = list(name = "purrr", path = "/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/purrr/libs/purrr.so",         dynamicLookup = FALSE, handle = <pointer: 0x9aab71e0>,         info = <pointer: 0x14bf61ea0>), numParameters = 6L),     <environment>, "logical", FALSE, 1L, NULL, 0L)
 2: call_with_cleanup(map_impl, environment(), .type, .progress,     n, names, i)
 3: withCallingHandlers(expr, error = function(cnd) {    if (i == 0L) {    }    else {        message <- c(i = "In index: {i}.")        if (!is.null(names) && !is.na(names[[i]]) && names[[i]] !=             "") {            name <- names[[i]]            message <- c(message, i = "With name: {name}.")        }        else {            name <- NULL        }        cli::cli_abort(message, location = i, name = name, parent = cnd,             call = error_call, class = "purrr_error_indexed")    }})
 4: with_indexed_errors(i = i, names = names, error_call = .purrr_error_call,     call_with_cleanup(map_impl, environment(), .type, .progress,         n, names, i))
 5: map_("logical", .x, .f, ..., .progress = .progress)
 6: map_lgl(dots, has_absolute_path)
 7: proj_path("NEWS.md")
 8: use_news_heading("(development version)")
 9: use_version(which = "dev")

My .Rprofile:

options(
  usethis.full_name = "Lars Dalby",
  usethis.protocol  = "ssh",
  usethis.description = list(
    "Authors@R" = utils::person(
      "Lars", "Dalby",
      email = "[email protected]",
      role = c("aut", "cre"),
      comment = c(ORCID = "0000-0002-7270-6999")
    )
  ),
  usethis.destdir = "~/Users/au206907/git",
  usethis.overwrite = TRUE
)

My .REnviron starts with these lines and then goes on for a while with database connection env vars for DBNAME, USER etc., but I don't think they would be relevant for this issue:

R_MAX_VSIZE=100Gb
GITHUB_PAT=<MY-PAT>
GITLAB_PAT=<MY-PAT>
ODBCSYSINI=/opt/homebrew/etc

Can't remember why I have a max size 100GB - I should probably get rid of that 😄

@gaborcsardi
Copy link
Member

Thanks, and sorry for the many questions. The only thing I can think of is a broken R installation at this point.

Can you try running this to see if it crashes as well:

purrr::map(letters, function(x) Sys.sleep(0.5), .progress=TRUE)

As a possible workaround, I only have drastic ideas at this point:

  1. Can you try reinstalling R. In you reinstall the same version, or 4.2.3, then you should not "lose" your packages.

  2. If that does not work, then you can try completely removing 4.2.2, including the package library and then installing it from scratch.

  3. Or, if you already remove the packages, you can also update to 4.3.1.

@LDalby
Copy link
Author

LDalby commented Jun 28, 2023

No worries, I'm just grateful for you taking the time to investigate this!

I can run the code below without crashing.

purrr::map(letters, function(x) Sys.sleep(0.5), .progress=TRUE)

I've been holding up upgrading to 4.3.1 but I think I will just do that now. Will have to do that at some point anyway.

One thing I was thinking though, was that I have several renv projects and possible several different version of the {cli} and {purrr} installed on my setup. Do you think that could have a impact on this issue?

@gaborcsardi
Copy link
Member

Do you think that could have a impact on this issue?

If renv is active when you see the crashes, then yes, definitely. Otherwise it is less likely, but still not impossible that somehow you ended up with a broken installation on cli (?).

@LDalby
Copy link
Author

LDalby commented Jun 29, 2023

It will crash also without renv being active.
I will wipe my R setup and see if a fresh install will fix it, but it will have to wait for a couple of weeks I'm afraid. Will report back on this thread with the result of reinstalling once it is done. Just to not leave this thread open ended.

@LDalby
Copy link
Author

LDalby commented Jul 11, 2023

I finally got around to upgrading my system.

I ran:

sudo rm -rf /Applications/R.app
sudo rm -rf /Library/Frameworks/R.framework

Then installed the latest version of R from r-project.org

Installed the packages I use and now usethis::use_version() works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants