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 shouldn't connect to repositories on startup #812
Comments
I suspect this is happening because of the synchronization check that
in an appropriate |
Here's the big stack trace I see:
And this is all ultimately coming from here: Lines 676 to 689 in 9344caf
So the most likely explanation is that you have one or more packages that |
Yikes! And I think this may be super-problematic for air-gapped systems. |
It does seem to help, so far ... |
Just found this thread today, after experiencing startup delays for some time. Setting |
I think this problem has been fixed because Lines 583 to 603 in fab327a
|
I think this can still happen if a package has an unknown source, since we call status here: Line 314 in 4c5a62f
and we have this bit of code: Lines 764 to 808 in 4c5a62f
Perhaps we need a toggle to disable that code during the synchronization check? |
Problem
It seems that on startup renv connects to all the repositories listed in the lockfile to check their status / available packages. This makes some sense when working interactively in a single R session, but becomes troublesome when you frequently launch new R sessions. The problem is especially serious, if you have multiple repositories listed in the lockfile and they happen to be unavailable - renv will incur a long delay with multiple retries for each repository.
This problem arose in a real use case. We use the box package to modularize a large Shiny app. Due to module caching in box, we need to run the app in a new R session each time we want to reload it. The app uses private packages available from a set of RSPM repositories, which can only be accessed via VPN. Sometimes, due to network issues or a configuration problem, the repositories cannot be accessed.
Proposed solution
I think renv should only connect to the repositories when it is needed, i.e. when instructed to install/update packages. This is how popular tools for creating isolated environments work in other languages, e.g. yarn in Node.js and venv in Python.
Notes
The problem could be alleviated by setting
renv.config.connect.timeout
to a low value, but a bug prevents it from working: this comment talks about using a shorter delay, but the code actually uses a fixed value which can be bigger than the setting provided by the user.The text was updated successfully, but these errors were encountered: