Repository navigation
Closed
Description
Is the following crash reproducible?
As of the current commit, running tests of current dev version of rlang
devtools::test()gives
Loading rlang
unloadNamespace("rlang") not successful, probably because another loaded package depends on it.Forcing unload. If you encounter problems, please restart R.
Loading required package: testthat
Testing rlang
✔ | OK F W S | Context
⠏ | 0 | arg
*** caught bus error ***
address 0x7f9e2901b778, cause 'non-existent physical address'
Traceback:
1: is_null(.ns)
2: lang(captureArg, substitute(arg))
3: enquo(object)
4: force(quo)
5: quasi_label(enquo(object), label)
6: expect_identical(arg_match(myarg, c("bar", "foo")), "foo")
7: eval(code, test_env)
8: eval(code, test_env)
9: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) skip_empty()}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error)
10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
13: doTryCatch(return(expr), name, parentenv, handler)
14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]])
15: tryCatchList(expr, classes, parentenv, handlers)
16: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) skip_empty()}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { })
17: test_code(desc, code, env = parent.frame())
18: test_that("matches arg", { myarg <- c("foo", "baz") expect_identical(arg_match(myarg, c("bar", "foo")), "foo") expect_error(regex = "`myarg` should be one of: \"bar\" or \"baz\"", arg_match(myarg, c("bar", "baz")))})
19: eval(code, test_env)
20: eval(code, test_env)
21: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) skip_empty()}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error)
22: doTryCatch(return(expr), name, parentenv, handler)
23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
25: doTryCatch(return(expr), name, parentenv, handler)
26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]])
27: tryCatchList(expr, classes, parentenv, handlers)
28: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) skip_empty()}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { })
29: test_code(NULL, exprs, env)
30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
31: force(code)
32: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, { lister$start_file(basename(path)) source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap) end_context() })
33: FUN(X[[i]], ...)
34: lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
35: force(code)
36: with_reporter(reporter = current_reporter, results <- lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap))
37: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap)
38: (function (path, filter = NULL, reporter = default_reporter(), env = test_env(), ..., encoding = "unknown", load_helpers = TRUE, stop_on_failure = FALSE, stop_on_warning = FALSE, wrap = TRUE) { if (!missing(encoding) && !identical(encoding, "UTF-8")) { warning("`encoding` is deprecated; all files now assumed to be UTF-8", call. = FALSE) } if (load_helpers) { source_test_helpers(path, env) } source_test_setup(path, env) on.exit(source_test_teardown(path, env), add = TRUE) withr::local_envvar(list(R_TESTS = "", TESTTHAT = "true")) withr::local_options(list(oldie_verbose_retirement = TRUE)) paths <- find_test_scripts(path, filter, ...) test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap)})("/Users/eha/projects/rlang/tests/testthat", filter = NULL, env = <environment>, load_helpers = FALSE, encoding = "unknown")
39: do.call(testthat::test_dir, testthat_args)
40: force(code)
41: withr::with_envvar(r_env_vars(), do.call(testthat::test_dir, testthat_args))
42: devtools::test()
An irrecoverable exception occurred. R is aborting now ...
Bus error: 10
Session info:
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2Metadata
Metadata
Assignees
Labels
No labels
Activity
egnha commentedon Oct 19, 2017
No crash with CRAN version of testthat.
hadley commentedon Oct 20, 2017
@lionel- can you please take a look?
lionel- commentedon Oct 20, 2017
I see failures but I don't see a crash. Maybe you need to recompile and reinstall testthat?
egnha commentedon Oct 21, 2017
@lionel- I still get a crash with the following procedure:
devtools::install_github()devtools::install_github()devtools::test()However, no crash if I skip 3 and proceed to 4. (I presume this might be what you observed.)
lionel- commentedon Oct 22, 2017
This is because the imports environment of testthat is not updated when
rlangis reloaded by devtools:It might be fine if these closures were scoped in the same namespace but that is not the case:
Thus the
.Call()s from the old rlang closures in testthat'simportsare calling into dangling pointers.@jimhester Could something be done about this in pkgload? In ESS we update the imports env of all loaded packages when the user updates a function definition in some namespace.
Re-create the imports environment of packages when reloading
hadley commentedon Nov 2, 2017
Moved to pkgload
Re-create the imports environment of packages when reloading