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

renv 1.0.0 check on startup can lead to long session loading time #1573

Closed
michalovadek opened this issue Jul 20, 2023 · 2 comments · Fixed by #1603
Closed

renv 1.0.0 check on startup can lead to long session loading time #1573

michalovadek opened this issue Jul 20, 2023 · 2 comments · Fixed by #1603
Labels
bug an unexpected problem or unintended behavior

Comments

@michalovadek
Copy link

michalovadek commented Jul 20, 2023

if an .*ignore file is missing or misspecified, loading an R project with renv that contains many files will take a long time because renv 1.0.0 checks all files at startup by default, without a prior warning or prompt (see also discussion here: #1181 (comment))

How I replicated the issue: I created a new R project in a new directory and created 100 000 dummy .txt files in subdirectory data. Opening the project hangs RStudio seemingly until the files are scanned. Adding data to .gitignore "fixes" it.

I think the user should be prompted whether they want to do the startup check if it involves a high number of files, otherwise it should be skipped. At very minimum they must be informed, as when running renv::status(). In a complex project it took me a while to figure out what was causing the slow loading time and at first did not realize this was related to updating renv to 1.0.0.

sessionInfo():

R version 4.2.3 (2023-03-15 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

attached base packages:
[1] stats graphics grDevices datasets utils methods base

loaded via a namespace (and not attached):
[1] compiler_4.2.3 tools_4.2.3 renv_1.0.0

@michalovadek michalovadek changed the title defau renv 1.0.0 check on startup can lead to long session loading time Jul 20, 2023
@michalovadek michalovadek reopened this Jul 20, 2023
@kevinushey
Copy link
Collaborator

We do display the following on renv::init():

> renv::init()
A large number of files (100000 in total) have been discovered.
It may take renv a long time to crawl these files for dependencies.
Consider using .renvignore to ignore irrelevant files.
See `?renv::dependencies` for more information.
Set `options(renv.config.dependencies.limit = Inf)` to disable this warning.

We suppress output like this here, though:

renv/R/load.R

Line 844 in 2d62bfa

renv_scope_options(renv.verbose = FALSE)

@michalovadek
Copy link
Author

even if there is a case for suppressing other types of output, I would say here the default option should be to display it whenever there is a chance the function will take a while to run. Since renv::init() is not run manually most of the time (I suspect?), the user actually does not know what's causing the hang.

@kevinushey kevinushey added this to the 1.0.1 milestone Jul 24, 2023
@kevinushey kevinushey added the bug an unexpected problem or unintended behavior label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants