Henrik Bengtsson
2011-May-12 17:55 UTC
[Rd] Reproducible use case for R crash after updating R
This might have been discussed before, but below is a "not-so-unlikely" use case where the user follows normal procedures, updates R to a major release version, and then R crashes: 1. Use runs R stable (e.g. v2.13.0). 2. User installs a package with a namespace, e.g. install.packages("fortunes"). 3. User uses the package and one of the package's objects are assigned to the global env, e.g. foo <- fortune. 4. The user quits R and stores the session data, e.g. q("yes"). The session is stored in users home directory. 5. User update to new major release of R (e.g. 2.14.0). 6. User starts R. R crashes with "Fatal error: unable to restore saved object in .RData" because 'fortunes' is not installed for this new version of R. There is also an error message before that reporting "Error in loadNamespace(name) : there is no package called 'fortunes'". This can also be reproduced using a single R version as follows: 1. Start R and do: install.packages("fortunes") library("fortunes") foo <- fortune remove.packages("fortunes") q("yes") 2. Restart R. R crashes. For a GUI-only user this is complicated, because although the users sees the informative error message that "Error in loadNamespace(name) : there is no package called 'fortunes'", s/he cannot get to the point where it is possible to install that missing package. The key for the user is to understand to remove the .RData. In order to do this, s/he has to locate that file first. To simplify this, a few alternatives exists: 1. R reports the full path to the problematic .RData file. 2. R renames the problematic .RData file to erroneous_20110512-123404UTC.RData and reports the new full pathname. In both cases there could be the option for R to either exit, or ignore the problematic .RData file and give the user access to the prompt. One could also imaging a fancy recovery feature where R detects "erroneous" .RData files and asks the user if s/he wish to try to load them (maybe the packages has been installed since). I'm sure there are complications to implement the above, because .RData is loaded during startup, but that's my $.02 to this problem /Henrik
Henrik Bengtsson
2011-May-12 18:26 UTC
[Rd] Reproducible use case for R crash after updating R
On Thu, May 12, 2011 at 10:55 AM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:> This might have been discussed before, but below is a > "not-so-unlikely" use case where the user follows normal procedures, > updates R to a major release version, and then R crashes: > > 1. Use runs R stable (e.g. v2.13.0). > 2. User installs a package with a namespace, e.g. install.packages("fortunes"). > 3. User uses the package and one of the package's objects are assigned > to the global env, e.g. foo <- fortune. > 4. The user quits R and stores the session data, e.g. q("yes"). ?The > session is stored in users home directory. > 5. User update to new major release of R (e.g. 2.14.0). > 6. User starts R. ?R crashes with "Fatal error: unable to restore > saved object in .RData" because 'fortunes' is not installed for this > new version of R. ?There is also an error message before that > reporting "Error in loadNamespace(name) : there is no package called > 'fortunes'". > > This can also be reproduced using a single R version as follows: > > 1. Start R and do: > install.packages("fortunes") > library("fortunes") > foo <- fortune > remove.packages("fortunes") > q("yes") > 2. Restart R. ?R crashes. > > For a GUI-only user this is complicated, because although the users > sees the informative error message that "Error in loadNamespace(name) > : there is no package called 'fortunes'", s/he cannot get to the point > where it is possible to install that missing package. ?The key for the > user is to understand to remove the .RData. ?In order to do this, s/he > has to locate that file first. > > To simplify this, a few alternatives exists: > > 1. R reports the full path to the problematic .RData file. > 2. R renames the problematic .RData file to > erroneous_20110512-123404UTC.RData and reports the new full pathname. > > In both cases there could be the option for R to either exit, or > ignore the problematic .RData file and give the user access to the > prompt. ?One could also imaging a fancy recovery feature where R > detects "erroneous" .RData files and asks the user if s/he wish to try > to load them (maybe the packages has been installed since).On Windows, the easiest way to give a GUI-only user access to the R prompt is to also install an "R (vanilla mode)" shortcut/icon on the Startup menu and Desktop (with target "...\Rgui.exe" --vanilla) in addition to the default one. /Henrik> > I'm sure there are complications to implement the above, because > .RData is loaded during startup, but that's my $.02 to this problem > > /Henrik >
Duncan Murdoch
2011-May-12 18:48 UTC
[Rd] Reproducible use case for R crash after updating R
On 12/05/2011 1:55 PM, Henrik Bengtsson wrote:> This might have been discussed before, but below is a > "not-so-unlikely" use case where the user follows normal procedures, > updates R to a major release version, and then R crashes:Thanks for putting together this nice reproducible example. I think acceptable behaviour in this case would be to offer to run in --vanilla mode, with a message that makes clear that installing the missing package would fix things. I don't know if that's feasible or not; it may be hard to back out of a partial load of .RData. Nice behaviour would be to be able to analyze an .RData file, and point out which objects in it can't be loaded because of missing packages, and do a partial load of just the required objects; that might be very helpful in a case where the file contains both valuable data and objects that can no longer be loaded, e.g. because a package won't run in the latest R release. I'll take a look at this. I don't expect the nice behaviour would make it into base R, but it would be nice if someone with spare time wrote a package to do that... Duncan> 1. Use runs R stable (e.g. v2.13.0). > 2. User installs a package with a namespace, e.g. install.packages("fortunes"). > 3. User uses the package and one of the package's objects are assigned > to the global env, e.g. foo<- fortune. > 4. The user quits R and stores the session data, e.g. q("yes"). The > session is stored in users home directory. > 5. User update to new major release of R (e.g. 2.14.0). > 6. User starts R. R crashes with "Fatal error: unable to restore > saved object in .RData" because 'fortunes' is not installed for this > new version of R. There is also an error message before that > reporting "Error in loadNamespace(name) : there is no package called > 'fortunes'". > > This can also be reproduced using a single R version as follows: > > 1. Start R and do: > install.packages("fortunes") > library("fortunes") > foo<- fortune > remove.packages("fortunes") > q("yes") > 2. Restart R. R crashes. > > For a GUI-only user this is complicated, because although the users > sees the informative error message that "Error in loadNamespace(name) > : there is no package called 'fortunes'", s/he cannot get to the point > where it is possible to install that missing package. The key for the > user is to understand to remove the .RData. In order to do this, s/he > has to locate that file first. > > To simplify this, a few alternatives exists: > > 1. R reports the full path to the problematic .RData file. > 2. R renames the problematic .RData file to > erroneous_20110512-123404UTC.RData and reports the new full pathname. > > In both cases there could be the option for R to either exit, or > ignore the problematic .RData file and give the user access to the > prompt. One could also imaging a fancy recovery feature where R > detects "erroneous" .RData files and asks the user if s/he wish to try > to load them (maybe the packages has been installed since). > > I'm sure there are complications to implement the above, because > .RData is loaded during startup, but that's my $.02 to this problem > > /Henrik > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Andreas Borg
2011-May-18 07:19 UTC
[Rd] Reproducible use case for R crash after updating R
Hi all, I'd like to add another suggestion: Henrik Bengtsson schrieb:> 6. User starts R. R crashes with "Fatal error: unable to restore > saved object in .RData" because 'fortunes' is not installed for this > new version of R. There is also an error message before that > reporting "Error in loadNamespace(name) : there is no package called > 'fortunes'". > >I would find it very useful if the installer offered an option to copy extension packages from the old version to the new version. Apart from possibly preventing this type of crash, it would save the hassle of reinstalling or copying the extension packages one regularly uses. Andreas -- Andreas Borg Medizinische Informatik UNIVERSIT?TSMEDIZIN der Johannes Gutenberg-Universit?t Institut f?r Medizinische Biometrie, Epidemiologie und Informatik Obere Zahlbacher Stra?e 69, 55131 Mainz www.imbei.uni-mainz.de Telefon +49 (0) 6131 175062 E-Mail: borg at imbei.uni-mainz.de Diese E-Mail enth?lt vertrauliche und/oder rechtlich gesch?tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt?mlich erhalten haben, informieren Sie bitte sofort den Absender und l?schen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.