wch / movies

Movie explorer Shiny app
10 stars 20 forks source link

lazy-load database 'P' is corrupt #3

Open phillip-burger-sculpturearts opened 10 years ago

phillip-burger-sculpturearts commented 10 years ago

Encountered below error. Any suggestions on how to resolve appreciated.

shiny::runApp() Error in get(Info[i, 1], envir = env) : lazy-load database 'P' is corrupt In addition: Warning message: In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

wch commented 10 years ago

The internal error -3 often happens when you use install_github to install a package that's currently loaded; try restarting R and running the app again.

jdthorpe commented 8 years ago

I find that this occurres when calling library(foo) for the second time when the library foo has been updated in between library() calls using any of the devtools install methods, as in:

# Load my super cool user package:
devtools::install('path/to/my/package')
library(MyPackage)

# do some testing in R ...

# find a bug in my R code ...

# edit the package code to fix a bug I found ...

# reload the package:
devtools::install('path/to/my/package')
library(MyPackage) 
#> Error in get(method, envir = home) : 
#>   lazy-load database 'C:/Users/User/Documents/R/win-library/3.2/MyPackage/R/MyPackage.rdb' is corrupt
#> In addition: Warning messages:
#> 1: In .registerS3method(fin[i, 1], fin[i, 2], fin[i, 3], fin[i, 4],  :
#>   restarting interrupted promise evaluation
#> 2: In get(method, envir = home) :
#>   restarting interrupted promise evaluation
#> 3: In get(method, envir = home) : internal error -3 in R_decompress1
#> Error: package or namespace load failed for ‘MarketQualityQuery’

Of course, you have to have an error in the library somewhere for this to occur. The most reliable way I've found to generate such an error is to comment out an Roxygen comment block and call devtools::document() and then devtools::install(). For example, If you have a function in your package like this one:

#' A function
#' 
#' This is a function.
#' 
#' @param x A parameter
#' 
#' @export
foo <- function(x)
    print(x)

and you comment out the comments like so:

#-- #' A function
#-- #' 
#-- #' This is a function.
#-- #' 
#-- #' @param x A parameter
#-- #' 
#-- #' @export
foo <- function(x)
    print(x)

and then you call :

devtools::document('path/to/my/package')
devtools::install('path/to/my/package')
library(MyPackage)

you'll get an the above error message, and devtools::install will clobber your package, requiring that R be re-started each time you want to re-load your library (which makes the process of debugging your package slooooow).

wch commented 8 years ago

I think if you're using a newer version of devtools, this shouldn't be an issue anymore. See hadley/devtools#1001

romunov commented 5 years ago

We've had similar issue with building a docker image. The packages are being built as a dependency so it would be pretty cumbersome to install dependencies first where order could be somewhat controlled. We've had this issue with assertthat package (everything worked two weeks ago).

Error in run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout),  : 
  lazy-load database '/usr/local/lib/R/site-library/assertthat/R/assertthat.rdb' is corrupt
Calls: install_github ... with.default -> eval -> eval -> with_envvar -> force -> run
In addition: Warning message:
In run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout),  :
  internal error -3 in R_decompress1
Execution halted
xargs: bash: exited with status 255; aborting