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? 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="") } }
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.
G'day all, running the script in : [R.app GUI 1.28 (5399) i386-apple-darwin9.6.0] R version 2.9.0 (2009-04-17) i386-apple-darwin9.6.0 locale: en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base returned : junk = 1 mjunk = -1 sum = 0 i = 522 junk = 1 mjunk = -1 sum = 0 i = 523 junk = 1 mjunk = -1 sum = 0 i = 524 junk = 1 mjunk = -1 sum = 0 i = 525 Error in mjunk[3, 30] : object of type 'closure' is not subsettable > Running it in the terminal returned: junk = 1 mjunk = -1 sum = 0 i = 954 junk = 1 mjunk = -1 sum = 0 i = 955 junk = 1 mjunk = -1 sum = 0 i = 956 junk = 1 mjunk = -1 sum = 0 i = 957 junk = 1 mjunk = -1 sum = 0 i = 958 Error in junk[1, 5] : object of type 'closure' is not subsettable I don't know if this helps you at all... cheers Ben On 07/08/2009, at 6:00 PM, Duncan Murdoch wrote:> 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-- Ben Madin REMOTE INFORMATION t : +61 8 9192 5455 f : +61 8 9192 5535 m : 0448 887 220 Broome WA 6725 ben at remoteinformation.com.au Out here, it pays to know...
Possibly Parallel Threads
- [R] Repeatable, But Time Varying R GUI Crash (PR#13880)
- Problem With Repeated Use Of Load/Save/Close Commands
- [R] Problem With Repeated Use Of Load/Save/Close Commands (PR#13841)
- [R] Problem With Repeated Use Of Load/Save/Close Commands (PR#13842)
- Help reading table rows into lists