Rich FitzJohn
2005-Nov-23 21:53 UTC
[Rd] Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)
Hi, Infinite recursion in S3 methods seem to crash R on Windows 2000 (R terminating with the ("Rgui.exe has generated errors...") message, rather than throwing an error. This happens with both Rgui and Rterm. The following toy example triggers this: myf <- function(x, ...) UseMethod("myf") myf.default <- function(x, ...) myf(x) myf(1) ...R crashes... Which I would expect to terminate with the usual "evaluation nested too deeply: infinite recursion" or protect stack overflow message. This may be related to the reported bug 8203 - apologies if this has been fixed. I couldn't find specific mention of this in the NEWS file. This does not happen on R 2.1.0 on Windows 2000 (same machine), or on R 2.2.0 on Linux. R/Machine version below. Cheers, Rich Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status major = 2 minor = 2.0 year = 2005 month = 10 day = 06 svn rev = 35749 language = R Windows 2000 Professional (build 2195) Service Pack 4.0 Locale: LC_COLLATE=English_New Zealand.1252;LC_CTYPE=English_New Zealand.1252;LC_MONETARY=English_New Zealand.1252;LC_NUMERIC=C;LC_TIME=English_New Zealand.1252 Search Path: .GlobalEnv, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base -- Rich FitzJohn rich.fitzjohn <at> gmail.com | http://homepages.paradise.net.nz/richa183 You are in a maze of twisty little functions, all alike
Henrik Bengtsson
2005-Nov-24 00:09 UTC
[Rd] Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)
Hi, trying the same on WinXP I get :R 2.1.1 Patched (2005-09-19) > myf(1) Error: protect(): protection stack overflow R 2.2.0 Patched (2005-11-21 r36410): > myf(1) Error: evaluation nested too deeply: infinite recursion / options(expressions=)? > options(expressions=50000) > myf(1) Error: protect(): protection stack overflow So either it has been fixed or there is a bug there that only shows up under certain conditions. Cheers Henrik Rich FitzJohn wrote:> Hi, > > Infinite recursion in S3 methods seem to crash R on Windows 2000 (R > terminating with the ("Rgui.exe has generated errors...") message, > rather than throwing an error. This happens with both Rgui and Rterm. > > The following toy example triggers this: > myf <- function(x, ...) > UseMethod("myf") > > myf.default <- function(x, ...) > myf(x) > > myf(1) > ...R crashes... > > Which I would expect to terminate with the usual "evaluation nested > too deeply: infinite recursion" or protect stack overflow message. > > This may be related to the reported bug 8203 - apologies if this has > been fixed. I couldn't find specific mention of this in the NEWS > file. > > This does not happen on R 2.1.0 on Windows 2000 (same machine), or on > R 2.2.0 on Linux. R/Machine version below. > > Cheers, > Rich > > Version: > platform = i386-pc-mingw32 > arch = i386 > os = mingw32 > system = i386, mingw32 > status > major = 2 > minor = 2.0 > year = 2005 > month = 10 > day = 06 > svn rev = 35749 > language = R > > Windows 2000 Professional (build 2195) Service Pack 4.0 > > Locale: > LC_COLLATE=English_New Zealand.1252;LC_CTYPE=English_New > Zealand.1252;LC_MONETARY=English_New > Zealand.1252;LC_NUMERIC=C;LC_TIME=English_New Zealand.1252 > > Search Path: > .GlobalEnv, package:methods, package:stats, package:graphics, > package:grDevices, package:utils, package:datasets, Autoloads, > package:base > > > -- > Rich FitzJohn > rich.fitzjohn <at> gmail.com | http://homepages.paradise.net.nz/richa183 > You are in a maze of twisty little functions, all alike > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >
Prof Brian Ripley
2005-Nov-24 07:00 UTC
[Rd] Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)
On Thu, 24 Nov 2005, Rich FitzJohn wrote:> Hi, > > Infinite recursion in S3 methods seem to crash R on Windows 2000 (R > terminating with the ("Rgui.exe has generated errors...") message, > rather than throwing an error. This happens with both Rgui and Rterm. > > The following toy example triggers this: > myf <- function(x, ...) > UseMethod("myf") > > myf.default <- function(x, ...) > myf(x) > > myf(1) > ...R crashes... > > Which I would expect to terminate with the usual "evaluation nested > too deeply: infinite recursion" or protect stack overflow message. > > This may be related to the reported bug 8203 - apologies if this has > been fixed. I couldn't find specific mention of this in the NEWS > file.PR#8203 is attributed to C-stack overflow, and there is a prominent message (quoted below) in NEWS.> This does not happen on R 2.1.0 on Windows 2000 (same machine), or on > R 2.2.0 on Linux. R/Machine version below.What is happening is that the Windows C stack is being overflowed before the evaluation limit is reached, and what happens thereafter is random. So it would probably also crash in 2.1.0 eventually. This has already been fixed, and the R-patched NEWS file says USER-VISIBLE CHANGES o options("expressions") has been reduced to 1000: the limit of 5000 introduced in 2.1.0 was liable to give crashes from C stack overflow. and the Windows CHANGES file says The maximum C stack size for RGui.exe and Rterm.exe has been increased to 10Mb (from 2Mb); this is comparable with the default on Linux systems and may allow some larger programs to run without crashes. -- 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
Peter Dalgaard
2005-Nov-24 09:31 UTC
[Rd] Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)
Rich FitzJohn <rich.fitzjohn at gmail.com> writes:> Hi, > > Infinite recursion in S3 methods seem to crash R on Windows 2000 (R > terminating with the ("Rgui.exe has generated errors...") message, > rather than throwing an error. This happens with both Rgui and Rterm. > > The following toy example triggers this: > myf <- function(x, ...) > UseMethod("myf") > > myf.default <- function(x, ...) > myf(x) > > myf(1) > ...R crashes... > > Which I would expect to terminate with the usual "evaluation nested > too deeply: infinite recursion" or protect stack overflow message. > > This may be related to the reported bug 8203 - apologies if this has > been fixed. I couldn't find specific mention of this in the NEWS > file. > > This does not happen on R 2.1.0 on Windows 2000 (same machine), or on > R 2.2.0 on Linux. R/Machine version below.This is presumably an issue of C stack size. We increased options("expressions") in 2.2.0 from 500 to 5000, thinking that "machines are bigger than that these days", but apparently not. So for 2.2.0 patched we have o options("expressions") has been reduced to 1000: the limit of 5000 introduced in 2.1.0 was liable to give crashes from C stack overflow. and in R-devel o options(expressions) reverts to the default of 5000 now stack checking is in place.> Cheers, > Rich > > Version: > platform = i386-pc-mingw32 > arch = i386 > os = mingw32 > system = i386, mingw32 > status > major = 2 > minor = 2.0 > year = 2005 > month = 10 > day = 06 > svn rev = 35749 > language = R > > Windows 2000 Professional (build 2195) Service Pack 4.0 > > Locale: > LC_COLLATE=English_New Zealand.1252;LC_CTYPE=English_New > Zealand.1252;LC_MONETARY=English_New > Zealand.1252;LC_NUMERIC=C;LC_TIME=English_New Zealand.1252 > > Search Path: > .GlobalEnv, package:methods, package:stats, package:graphics, > package:grDevices, package:utils, package:datasets, Autoloads, > package:base > > > -- > Rich FitzJohn > rich.fitzjohn <at> gmail.com | http://homepages.paradise.net.nz/richa183 > You are in a maze of twisty little functions, all alike > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907