On 17/12/2008 5:34 PM, Richard E. Chandler wrote:
Dear R-help,

Like several other subscribers, I have recently encountered a problem whereby R will execute code apparently correctly and without error, but any subsequent command will yield "Error: bad value" so that R has to be killed and restarted. We have checked this out with a few different operating systems (Windows XP/Vista and Linux) and with different versions of R. We have established the following:

The symptoms you describe suggest an out of bounds read or write. Unfortunately, I don't see the error, in R-devel or R 2.8.0.

Tracking this sort of bug down on Windows is pretty hard, because as far as I know valgrind doesn't run on Windows, and I don't know of any Windows equivalent that supports gcc.

So I'm not going to be able to help...other than to suggest reducing the example to something that runs quickly, then try running it after running gctorture(). That often flushes out hard to reproduce bugs, but it goes very slowly...

Duncan Murdoch


1. The error occurs with versions of R from 2.5.0 onwards on all the OSs we have tried, but not with earlier versions of R. 2. The error is not reproducable between machines - identical code will fail at different points on two different machines. 3. The error is not related to contributed packages, because our code doesn't use any. The code *does*, however, use repeated calls to optim() and nlm(), and passes several arguments through a sequence of functions using "...". 4. Occasionally, we get an error relating to subset replacement instead of "Error:bad value". For example:

 > x <- rnorm(10)
 > x[1] <- 3
Error in x[1] <- 3 : could not find function "[<-"

5. The error behaviour changes as a result of minor modifications to print() statements in the code e.g. by inserting a line that prints the value of a well-defined variable.

I suspect this really *is* a bug (particularly since it only started happening with version 2.5.0), but I figure it would be worth giving people a chance to tell me I'm an idiot before reporting it as such. In case anybody would like to try and see the error for themselves, I have uploaded some files to http://www.homepages.ucl.ac.uk/~ucakarc/Rtest/. The file ErrorDemo.r is the main script - see the file header there for more details. Files momfit.r and elmstats.dat are also required for this example to work. I'm sorry that it isn't a very simple example, but I haven't seen a simple illustration of the problem (and I couldn't find any examples in the list archives either).

With best wishes to all,
Richard
=====================================================================
                        Richard E. Chandler
                        ^^^^^^^^^^^^^^^^^^^
Room 135, Dept of Statistical Science, University College London,
1-19 Torrington Place, London WC1E 6BT, UK
Tel: +44 (0)20 7679 1880                Fax: +44 (0)20 7383 4703

Internet: http://www.ucl.ac.uk/Stats                    (department)
           http://www.homepages.ucl.ac.uk/~ucakarc      (personal)
email:    rich...@stats.ucl.ac.uk

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to