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

Corrupted lazy-load database when knitting create-litr.Rmd #30

Closed
patrickvossler18 opened this issue Nov 5, 2022 · 1 comment · Fixed by #31
Closed

Corrupted lazy-load database when knitting create-litr.Rmd #30

patrickvossler18 opened this issue Nov 5, 2022 · 1 comment · Fixed by #31

Comments

@patrickvossler18
Copy link
Collaborator

patrickvossler18 commented Nov 5, 2022

When I get to the document and test section of knitting creat-litr.Rmd I get the following error message:

Error in eapply(ns_env(name), force, all.names = TRUE) : 
  lazy-load database '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/litr/R/litr.rdb' is corrupt
Calls: local ... <Anonymous> -> unregister -> unregister_namespace -> eapply
In addition: Warning message:
In eapply(ns_env(name), force, all.names = TRUE) :
  internal error -3 in R_decompress1
Execution halted
Quitting from lines 1065-1072 (create-litr.Rmd) 
Error: Failed to run 'test_litr' in a new R session.
Execution halted
Error: Failed to run 'render_' in a new R session.
Execution halted

It appears this is happening when we call xfun::Rscript_call(test_litr). This error typically goes away after restarting one's R session, but we can't do that when we're knitting our file. I've also successfully replicated this error on a different computer.

From the discussion here and here, my guess is that this is happening because of changes tolitr after it has been loaded.

@patrickvossler18
Copy link
Collaborator Author

The fix that works for me is to unload the package before calling devtools::install(location_of_new) in test_litr:

test_litr <- function(install_old, location_of_new) {
  devtools::unload(params$package_name)
  devtools::install(location_of_new)
  out <- devtools::test(location_of_new)
  install_old()
  return(out)
}

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

Successfully merging a pull request may close this issue.

1 participant