[Rd] R hangs sometimes and crashes (PR#429)

kjetikj@astro.uio.no kjetikj@astro.uio.no
Fri, 11 Feb 2000 11:54:58 +0100 (MET)


Full_Name: Kjetil Kjernsmo
Version: 0.65.1
OS: Digital UNIX 4.0
Submission from: (NULL) (129.240.28.172)


I have the following R code:

ncloudsbin <- function(binno, ntotalclouds, numberofbins = 100, linewidth =
numberofbins / 6)
  return(ntotalclouds * dnorm(binno, sd = linewidth))

photonsincidenttodetectorbin <- function(binno, ntotalclouds,
avgphotonfromcloud, ampmode = 1, ampmean = 2, numberofbins = 100, linewidth =
numberofbins / 6)
{
  sc <- ampmean - ampmode
  if(sc <= 0) stop("Mean Amplification must be greater than Mode Amplification")

  ncb <- ncloudsbin(binno, ntotalclouds, numberofbins, linewidth)
  return(sum(rgamma(ncb, ampmean / sc, sc) * rpois(ncb, avgphotonfromcloud)))
}



photonsdetectedbin <- function(binno, ntotalclouds, avgphotonfromcloud,
sensitivity, ampmode = 1, ampmean = 2, numberofbins = 100, linewidth =
numberofbins / 6)
  return(rpois(1, sensitivity * photonsincidenttodetectorbin(binno,
ntotalclouds, avgphotonfromcloud, ampmode, ampmean, numberofbins, linewidth)))

lensedprofile <- function(ntotalclouds, avgphotonfromcloud, sensitivity, ampmode
= 1, ampmean = 2, numberofbins = 100, linewidth = numberofbins / 6)
  return(apply(cbind(x1 =
-as.integer(numberofbins/2):as.integer(numberofbins/2)), 1, photonsdetectedbin,
ntotalclouds, avgphotonfromcloud, sensitivity, ampmode, ampmean, numberofbins,
linewidth))

And I have experienced quite often that in 'photonsdetectedbin', R hangs. That
is, while 
it normally takes a second to get an array with the numbers, I let it run for
550 minutes
on an alphaev6 without anything happening. It seemed that it hanged more
frequently for 
small values of ntotalclouds (<8000), but that may not be the case. Anyway, it
happens 
only occasionally, sometimes a call like 
 plot(lensedprofile(10000,1,0.1, ampmean=3), type='l')
will produce a plot instantly, sometimes it will not....
Just now, R crashed, and that is when I figured I should send a bug report...
ESS said:
Process R segmentation fault at Fri Feb 11 11:40:15 2000
Unfortunately, I haven't got a core dump, I've disabled them, I could enable it
if you'd like.

I hope running lensedprofile a number of times will reproduce the problem, but
you never know,
as I haven't been able to narrow the problem down. I haven't had any problems
with 
photonsincidenttodetectorbin, though.

I haven't found any other relevant bug reports.

Kjetil

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._