From sfalcon at fhcrc.org  Tue Jun 12 16:43:09 2007
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Tue, 12 Jun 2007 07:43:09 -0700
Subject: [Rd] bug in R environments? Was: [BioC] 'recursive default
	argument' error...
In-Reply-To: <Pine.LNX.4.64.0706121110030.1465@gannet.stats.ox.ac.uk> (Brian
	Ripley's message of "Tue, 12 Jun 2007 12:12:39 +0100 (BST)")
References: <466E582C.4040108@ebi.ac.uk>
	<Pine.LNX.4.64.0706121110030.1465@gannet.stats.ox.ac.uk>
Message-ID: <m2odjlkzcy.fsf@ziti.local>

Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> 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.

The issue at hand is, I believe, the same as that discussed here:

http://thread.gmane.org/gmane.comp.lang.r.devel/8103/focus=8104

> I cannot reproduce your example on my system: I was able to interrupt but 
> repeating the as.list worked.

Try with a larger environment.  I can reproduce this with a recent
R-devel using the GO package:

    > library(GO)
    > GOTERM
    ^C
    > GOTERM
    Error: recursive default argument reference

> 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.

Good guesses.  Yes, _all_ Bioconductor annotation data packages
currently store each identifier mapping in a separate environment.  So
the package environment contains environments.  The lazy loading db is
important at runtime when users may only need to access one or two of
the environments.  We generate the lazy-loading dbs by hand so that
users installing from source do not have to repeat the process
themselves.  Since the environments are large, it is possible to use
the packages on a system that does not have enough memory to
"properly" install them.

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org



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