[R] Repeatable, But Time Varying R GUI Crash

Duncan Murdoch murdoch at stats.uwo.ca
Thu Aug 6 22:40:57 CEST 2009


On 8/6/2009 4:11 PM, Marilyn & Rich Short wrote:
> Hello,
> 
> I'm having a problem in R. The R GUI is crashing with a message to 
> contact Microsoft for the solution. I've contacted Microsoft and they 
> are of no help. Below is a distilled set of code that will cause the 
> crash. As you will see, there are two do-loops within which is a "load" 
> command. The crash usually occurs after 200*400 (=80,000) to 
> 2,000*400(=800,000) iterations.
> 
> Do you have any suggestions on work-arounds?

I can confirm it in R-patched as well.  It happens on the very first 
time through if you set gctorture() on, so it looks like somewhere in 
there is a missing PROTECT, and the garbage collector is reclaiming 
something that it shouldn't.

I'll try to track it down, but I'm not sure how quick I'll be.  (My 
house is full of contractors right now, so not a very nice place to work.)

I don't know any workaround other than "avoid doing the buggy thing". 
But I can't tell you what that is....

Duncan Murdoch

> Once you start the function with the  "problem2()" command, the function 
> will print to the screen once every 400 iterations. You can monitor the 
> progress by clicking the scroll button. The R GUI should crash somewhere 
> between i=200 and i=2000. Although the problem is repeatable, the time 
> at which the crash occurs is random.
> 
> Thanks in advance for your attention,
> 
> Rich Short
> 
> I'm using Windows XP, SP3 and R 2.9.1.
> Here is my session info:
> 
>> sessionInfo()
> R version 2.9.1 (2009-06-26)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> 
> (The problem occurs on my Vista machine as well.)
> *******************************************
> 
> # This script induces the R GUI to crash.
> 
> problem2 = function(){
> 
> junk = mat.or.vec(8,40)
> 
> junk[] = 1
> 
> mjunk = mat.or.vec(8,40)
> 
> mjunk[] = -1
> 
> PathA = tempdir()
> 
> conX = paste(PathA,"junkx",sep="\\")
> 
> conY = paste(PathA,"junky",sep="\\")
> 
> outJunk = file(conX, open="wb")
> 
> save(junk, file=outJunk)
> 
> close(outJunk)
> 
> outJunkY = file(conY, open="wb")
> 
> save(mjunk, file=outJunkY)
> 
> close(outJunkY)
> 
> sign = 1
> 
> for(i in 1:4000){
> 
> for(ii in 1:400){
> 
> sign = -sign
> 
> if(sign<0){
> 
> load(file=conX)
> 
> }else{
> 
> load(file=conY)
> 
> }
> 
> sum = junk[1,5] + mjunk[3,30]
> 
> }
> 
> cat(" junk = ",junk[1,5],sep="")
> 
> cat(" mjunk = ",mjunk[3,30],sep="")
> 
> cat(" sum = ",sum,sep="")
> 
> cat(" i = ",i,"\n",sep="")
> 
> }
> 
> }
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list