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

RStudio Server crash, restart requires project reopen to load packrat libs #549

Open
ras44 opened this issue Apr 10, 2019 · 5 comments
Open

Comments

@ras44
Copy link
Contributor

@ras44 ras44 commented Apr 10, 2019

In using RStudio Server with packrat, if the session crashes, a dialog box will pop up mentioning "The previous R session was abnormally terminated due to an unexpected crash. You may have lost workspace data as a result of this crash." ; however when it does restart, the packrat project libraries look like they are available, but they cannot be loaded with library(xyz). They are correctly available if I reopen the project (ie. .Rprofile can run source("packrat/inti.R")), and packrat can access the project libraries.

A reprex would be:

  • create an R Project that uses packrat and install a library (say, "xyz") that is not available in the system or user libraries (ie. "xyz" would only be available via packrat)
  • crash RStudio Server with .Call("abort")
  • view the "The previous R session was abnormally terminated due to an unexpected crash. You may have lost workspace data as a result of this crash." dialog
  • attempt to run library("xyz") and confirm that the package can't be loaded
  • reopen the project and confirm that the package can be loaded with library("xyz")

It looks like the working directory is also the user's home directory after the crash. I'm not sure if that may be playing a role here.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Apr 10, 2019

What are the library paths after the restart? (What is the output of .libPaths()?)

I suspect that RStudio is perhaps overriding the library paths normally set by Packrat or something similar in this case.

@ras44
Copy link
Contributor Author

@ras44 ras44 commented Apr 10, 2019

The output of .libPaths() is:

[1] "/home/userid/project/packrat/lib/x86_64-redhat-linux-gnu/3.5.0"    
[2] "/home/userid/project/packrat/lib-ext/x86_64-redhat-linux-gnu/3.5.0"
[3] "/home/userid/project/packrat/lib-R/x86_64-redhat-linux-gnu/3.5.0"  

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Apr 10, 2019

That's the output when you can't load the package? (I'm just surprised because my guess here is that the library paths are not being correctly restored after a crash, and so I would've expected different library paths)

@ras44
Copy link
Contributor Author

@ras44 ras44 commented Apr 10, 2019

That is weird. I was able to reproduce this error for one project until I called .libPaths() and produced that result. Now I cannot reproduce the error. I will try it with a fresh project to see if I can reproduce.

@ras44 ras44 closed this as completed Apr 12, 2019
@ras44
Copy link
Contributor Author

@ras44 ras44 commented Apr 12, 2019

I have had that issue repeatedly over the past months, but after running .libPaths() once in one project, I'm unable to reproduce it in any of the projects it was happening in.

I do still run into one part of this issue: if I modify any file in the project's R directory after a crash-restart and then attempt to save the file, I get an error: "Error Saving File: No such file or directory". When I run getwd(), it returns the project's base directory.

@ras44 ras44 reopened this Apr 12, 2019
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

No branches or pull requests

2 participants