klaster@karlin.mff.cuni.cz
2004-Jan-28 20:36 UTC
[Rd] unstability when using isoreg() function (PR#6494)
Full_Name: Petr Klasterecky Version: 1.8.1 OS: Windows XP, Linux Submission from: (NULL) (195.113.27.212) The isoreg() function causes R to crash when called repeatedly. Consider the following simple script: { library(modreg) N <- 10 x <- rnorm(N) print("Original x values:") print(x) for(n in (1:N)){print(y <- isoreg(x[1:n])$yf)} } I am able to run (call) it several times, let say 6 or 10 times, and when trying once more, R crashes. In Windows a screen with "The R GUI software has caused errors and will be terminated by windows. All unsaved information will be lost." message appears, using Linux R crashes with a mesage "Segmentation fault".
dmurdoch@pair.com
2004-Jan-29 09:47 UTC
[Rd] unstability when using isoreg() function (PR#6494)
On Wed, 28 Jan 2004 17:31:27 +0100 (CET), you wrote:>Full_Name: Petr Klasterecky >Version: 1.8.1 >OS: Windows XP, Linux >Submission from: (NULL) (195.113.27.212) > > >The isoreg() function causes R to crash when called repeatedly. Consider the >following simple script: > >{ >library(modreg) >N <- 10 >x <- rnorm(N) >print("Original x values:") >print(x) >for(n in (1:N)){print(y <- isoreg(x[1:n])$yf)} >}I get the crash reproducibly in r-devel after I put "set.seed(2)" ahead of the sample code above. (Of course, r-devel doesn't need the library(modreg), but that doesn't affect the bug.) Other seeds and the code works without error. I tried tracing into R_isoreg to try to spot the problem, but the error occurs after it returns. It has all the symptoms of some code writing outside allocated bounds, but I couldn't see where that happened. Duncan Murdoch
klaster@karlin.mff.cuni.cz
2004-Jan-29 11:14 UTC
[Rd] unstability when using isoreg() function (PR#6494)
> >{ > >library(modreg) > >N <- 10 > >x <- rnorm(N) > >print("Original x values:") > >print(x) > >for(n in (1:N)){print(y <- isoreg(x[1:n])$yf)} > >} > > I get the crash reproducibly in r-devel after I put "set.seed(2)" > ahead of the sample code above. (Of course, r-devel doesn't need the > library(modreg), but that doesn't affect the bug.) Other seeds and > the code works without error.Dear sir, Thank you for a swift reply. Yes, but I don't think that seed 2 is the only one producing the crash, since it occured quite randomly in my testing. For this seed=2 the problem appeared for isoreg(x[1:3]) and nowhere else, I have tried it just now. But, after restarting R, I was able to run isoreg(x[1:4]) through isoreg(x[1:10]), then isoreg(x[1:3]) and only after calling isoreg(x[1:3]) again R crashed - so even when I knew there was a problem in isoreg(x[1:3]), it worked (once). Please let me know if I could do anything else/more to help in tracking the problem. Best regards, Petr Klasterecky
ripley@stats.ox.ac.uk
2004-Jan-29 12:34 UTC
[Rd] unstability when using isoreg() function (PR#6494)
iKnots was allocated one element too short. This only overruns if the sequence is monotone, as happens here for set.seed(2), N=3. Fixed in R-devel. The line 39 in isoreg.c needs to be SET_VECTOR_ELT(ans, 3, iKnots= allocVector(INTSXP, n)); Duncan was trying to give a reproducible example, Petr, as we do ask you to do in the FAQ. On Thu, 29 Jan 2004 dmurdoch@pair.com wrote:> On Wed, 28 Jan 2004 17:31:27 +0100 (CET), you wrote: > > >Full_Name: Petr Klasterecky > >Version: 1.8.1 > >OS: Windows XP, Linux > >Submission from: (NULL) (195.113.27.212) > > > > > >The isoreg() function causes R to crash when called repeatedly. Consider the > >following simple script: > > > >{ > >library(modreg) > >N <- 10 > >x <- rnorm(N) > >print("Original x values:") > >print(x) > >for(n in (1:N)){print(y <- isoreg(x[1:n])$yf)} > >} > > I get the crash reproducibly in r-devel after I put "set.seed(2)" > ahead of the sample code above. (Of course, r-devel doesn't need the > library(modreg), but that doesn't affect the bug.) Other seeds and > the code works without error. > > I tried tracing into R_isoreg to try to spot the problem, but the > error occurs after it returns. It has all the symptoms of some code > writing outside allocated bounds, but I couldn't see where that > happened. > > Duncan Murdoch > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595