From blindglobe at gmail.com  Tue Apr 11 13:30:03 2006
From: blindglobe at gmail.com (A.J. Rossini)
Date: Tue, 11 Apr 2006 13:30:03 +0200
Subject: [Rd] Stack checking, core dumps, and embedding R
In-Reply-To: <Pine.LNX.4.64.0604111121440.30083@gannet.stats.ox.ac.uk>
References: <1abe3fa90604110234v1b4958c0w1e51e2b49f7ff9c5@mail.gmail.com>
	<Pine.LNX.4.64.0604111121440.30083@gannet.stats.ox.ac.uk>
Message-ID: <1abe3fa90604110430g12e4aafag7e4e5dd2e7a38e1@mail.gmail.com>

On 4/11/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> On Tue, 11 Apr 2006, A.J. Rossini wrote:
>
> > I will say this first -- I can't copy/paste the error message from the
> > screen, so it's being retyped.  Errors might occur.  SORRY.
> >
> > I've been experiencing some interesting stack warnings recently when
> > moving from R 2.2.x to the R 2.3.0 series and the R 2.4.0 series.  In
> > particular, I'm getting warnings of "Error: C stack usage is too close
> > to the limit" before segfaulting, and this wasn't happening under the
> > 2.2.x series.
> >
> > Here's the question statement:  (ONLY) In the situation where one is
> > embedding R, is anyone else seeing this occur with recent (past 2
> > weeks) versions of R (both the 2.3.x and 2.4.x series)?
>
> It is likely reporting a real problem that was not spotted in 2.2.1,
> and that in the embedded case the stack usage is higher that standalone.
>
> I am guessing this is Linux.  If so, does the simple expedient of raising
> the stack limit (in the shell, before launching the application) help?
> (I have done so for a couple of uses of R, and had no more problem.)
>
> For Windows, the relevant stack limit is in the calling application, and
> that is likely to be too low (1Mb or 2Mb: the R front-ends use 10Mb).
>
> > (it doesn't happen in the non-embedded case for me, at least not
> > recently -- there was an SVN version recently where I did get that
> > behavior in the non-embedded case, but it was "fixed" before I had a
> > chance to report).
> >
> > I'm still debugging it; hopefully will have a bug report while I'm on
> > (working) vacation in the states next week.
>
> Is this actually a bug, or at least one in R?  There are new tools like
> Cstack_info() that can help to track down excessive stack usage.

I don't know yet if it's a bug in R; if I knew so, I would have
submitted an R bug report.  I noted the stack monitoring changes that
were made, and working through the logic in the code (I seem to recall
main.c, errors.c, and one other file), it "seemed" correct.

This is indeed under Linux.   I'm unable to get to "command submission
function"
as I was before, so I'll be "backtracking" tonight with an earlier
version of the code.   I will try the suggestions that Brian made, and
will report back later tonight.

If anyone else has success or problems with embedding with this series
of R (2.3.x, 2.4.x), I'd appreciate input.   Again, I'm not seeing
this with normal CLI operation of R at this point.

best,
-tony

blindglobe at gmail.com
Muttenz, Switzerland.
"Commit early,commit often, and commit in a repository from which we can easily
roll-back your mistakes" (AJR, 4Jan05).



[Rd] Stack checking, core dumps, and embedding R
A.J. Rossini