[Rd] Reproducible use case for R crash after updating R

Duncan Murdoch murdoch.duncan at gmail.com
Thu May 12 20:48:03 CEST 2011


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



More information about the R-devel mailing list