core dump involving function closure (PR#402)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
25 Jan 2000 10:42:47 +0100


jlindsey@alpha.luc.ac.be writes:

> A user has crashed R90.1 on MS Windows by succesive calls to two of my
> formula/function interpretors in an order that I had not foreseen. I
> have checked and this also occurs with Intel RH5.2. I have distilled
> the problem down to its bare bones as the following set of
> instructions:
> 
> func <- function(.mu){
> 	.ch1 <- deparse(.mu,width=500)[-1]
> 	.fn <- eval(parse(text=paste("function()",
> 		paste("eval(attr(.fn,\"model\"))"))))
> 	attr(.fn,"model") <- parse(text=.ch1)
> 	.fn}
> 
> mu <- function() eval(attr(.fn,"model"))
> func(mu)()
> 
> debug does not help much. It looks like an infinite loop to me but
> that is no excuse for a crash. I have modified my functions so that it
> can now only occur in one very improbable case. Jim

Ouch. This kind of crash happens when the C stack grows too big and
you can no longer access automatic variables created on it. That's
pretty darn hard to avoid unless we want to put in some kind of
maxdepth check in the evaluator (which I suppose we could do).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._