[Rd] bug in R environments? Was: [BioC] 'recursive default argument' error...

Prof Brian Ripley
Tue, 12 Jun 2007 11:12:39 -0000

On Tue, 12 Jun 2007, Oleg Sklyar wrote:

> Dear developers,
>
> has anyone experienced the problem described below? Is it a bug in
> handling interrupts in R?

I am not sure where you think the 'bug' is in: cf your subject line.
My guess is that the package is using environments in a vulnerable way.

I cannot reproduce your example on my system: I was able to interrupt but
repeating the as.list worked.  What I suspect may have happened is that
you have interrupted lazy loading.  From the code

 	    if(PRSEEN(e))
 		errorcall(R_GlobalContext->call,
 			  _("recursive default argument reference"));
 	    SET_PRSEEN(e, 1);
 	    val = eval(PRCODE(e), PRENV(e));
 	    SET_PRSEEN(e, 0);

so you will get this message from a promise whose evaluation was
incomplete.  I can see several ways around that, but most have runtime
costs or back-compatibility issues.  (Changing the message may help.)

It looks like rae230a has been implemented to use lazy-loading on whole
environments (the 'source' is already a lazyload database, so it's
not
transparent).  Lazy-loading was intended for members of environments.

Also, does this happen in R-devel?  There lazy-loading is considerably
faster and closer to an atomic operation.

All guesswork on something I cannot reproduce, of course.


>
> Best,
> Oleg
>
> -------- Original Message --------
> Subject: Re: [BioC] 'recursive default argument' error in
GOENTREZID2GO
> From: Diego Diez <diez at kuicr.kyoto-u.ac.jp>
>
> ...steps that use to reach me to that point. It happens with any
> environment, or at least annotation packages stored as environments.
> I can't think of any reason why this happens but let me show you the
> code:
>
>> library(rae230a)
>> xx <- as.list(rae230aENTREZID)
> ^C
>> xx <- as.list(rae230aENTREZID)
> Error in as.list(rae230aENTREZID) : recursive default argument reference
>
> now, while the as.list() is working, cancel the process with control-
> C, and after that, the mentioned error happens whenever you try to
> repeat the process of transforming the environment to a list. The
> cancel must be done soon after hitting return, I found one case when
> delaying a little made me unable to reproduce the error. Other
> environments found in the package are not affected (i.e.
> rae230aSYMBOL, rae230aGENENAME, etc).
>
> Going deeper to the problem, I found that canceling the environment
> "loading" with any function reproduces the problem:
>
>> is(rae230aSYMBOL)
> ^C
>> is(rae230aSYMBOL)
> Error in .class1(object) : recursive default argument reference
>> rae230aSYMBOL
> Error: recursive default argument reference
>
> By "loading" a mean that the first time I execute as.list
> (rae230aSYMBOL) or is(rae230aSYMBOL) there is a delay which I assume
> is the environment being loaded into memory. Any further execution of
> the same commands will occur almost immediately.
>
> So, why should I cancel an environment loading soon after trying to
> load it? It happens that I was loading an environment inside a
> function, ran the function and wanted to cancel the execution, thus,
> the error appeared and the environemnt was unusable. Anyway, this
> seems to me more an R related issue.
>
> HTH,
>
> Diego.
>
>
>> sessionInfo()
> R version 2.5.0 (2007-04-23)
> powerpc-apple-darwin8.9.1
>
> locale:
> C
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices"
"utils"     "datasets"
> "methods"
> [7] "base"
>
> other attached packages:
>  rae230a
> "1.16.0"
>>
>
>
>
> On Jun 11, 2007, at 11:27 PM, Seth Falcon wrote:
>
>> "James W. MacDonald" <jmacdon at med.umich.edu> writes:
>>
>>> Hi Oleg,
>>>
>>> Oleg Sklyar wrote:
>>>> Hi,
>>>>
>>>> anybody has an idea as for the following error, the example is
>>>> actually
>>>> from the GO package examples. Thanks, Oleg
>>>>
>>>>> library(GO)
>>>>> egId <- "10043"
>>>>> egIdGoData <- GOENTREZID2GO[[egId]]
>>>> Error: recursive default argument reference
>>>
>>> I sometimes see that error as well. I have no idea what causes it,
>>> as it
>>> doesn't seem repeatable. Anyway, quitting R and starting over
has
>>> always
>>> fixed the problem for me.
>>
>> Oleg, is this reproducible for you?  I wasn't able to get the
error.
>> Have you tried updating to R patched?
>>
>> + seth
>>
>> --
>> Seth Falcon | Computational Biology | Fred Hutchinson Cancer
>> Research Center
>> http://bioconductor.org
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives: http://news.gmane.org/
>> gmane.science.biology.informatics.conductor
>
>

--
Brian D. Ripley,                  ripley at 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