From ripley at stats.ox.ac.uk  Tue Apr 11 12:30:13 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 11 Apr 2006 11:30:13 +0100 (BST)
Subject: [Rd] Stack checking, core dumps, and embedding R
In-Reply-To: <1abe3fa90604110234v1b4958c0w1e51e2b49f7ff9c5@mail.gmail.com>
References: <1abe3fa90604110234v1b4958c0w1e51e2b49f7ff9c5@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0604111121440.30083@gannet.stats.ox.ac.uk>

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.

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

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



[Rd] Stack checking, core dumps, and embedding R
Prof Brian Ripley