ripley@stats.ox.ac.uk
2005-Apr-30 11:47 UTC
(PR#7826) [Rd] segfault during build of 2.1.0 on RH9; print.POSIXct
1) Why did you submit this *twice*, as PR#7826 and PR#7827? Please don't be so careless of the volunteers' time. 2) > print.POSIXct function (x, ...) { print(format(x, usetz = TRUE, ...), ...) invisible(x) } is definitely *not* implicated. (Use of ... in two places is correct.) 3) On FC3:> unusual_and_faultsError: protect(): protection stack overflow> format(unusual_and_faults)Error: protect(): protection stack overflow> as.POSIXlt(unusual_and_faults)Error: protect(): protection stack overflow which is what should happen. It looks like RH9 has an inadequate stack size for the new recursion limits of R 2.1.0. This is nothing whatsoever to do with print.POSIXct. The problem is in fact in c.POSIXct which is not checking its arguments. On Sat, 30 Apr 2005 Jskud@jskud.com wrote:> In attempting to build R using > > rpmbuild --rebuild R-2.1.0-0.fdr.2.fc3.src.rpm > > on a fairly up-to-date RedHat 9 system (that is, with patches installed > through May 1 2004), it failed at the make check-all step. > > The problem was reproducible by going into the tests directory and > > make test-Segfault > > The last lines of the saved file no-segfault.Rout.fail are > >>> ## c.POSIXct : >>> f <- get("c.POSIXct", pos = 'package:base') >>> f() >> character(0) >>> f(NULL) >> character(0) >>> f(,NULL) >> Error in lapply(list(...), unclass) : argument is missing, with no default >>> f(NULL,NULL) >> character(0) >>> f(list()) >> character(0) >>> f(l0) >> character(0) > > I was able to reproduce the problem (a segfault) as the following simple > transcript demonstrates: > > LC_ALL=C SRCDIR=. R_DEFAULT_PACKAGES= ../bin/R --vanilla > > R : Copyright 2005, The R Foundation for Statistical Computing > Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 > > R is free software and comes with ABSOLUTELY NO WARRANTY. > You are welcome to redistribute it under certain conditions. > Type 'license()' or 'licence()' for distribution details. > > R is a collaborative project with many contributors. > Type 'contributors()' for more information and > 'citation()' on how to cite R or R packages in publications. > > Type 'demo()' for some demos, 'help()' for on-line help, or > 'help.start()' for a HTML browser interface to help. > Type 'q()' to quit R. > > > unusual_but_ok <- c.POSIXlt(character(0)) > > unusual_but_ok > character(0) > > unusual_and_faults <- c.POSIXct(character(0)) > > unusual_and_faults > Segmentation fault > > Running this test program under gdb, we find that we're running off the > end of the stack, with 4222 stack frames showing -- apparently in an > infinite recursion -- "as.character" shows up every 69 function calls: > > #64 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, > args=0x8af8b00, rho=0x8af8b70, callrho=0x8af8b70, defrho=0x829d4c0, ans=0xbff042b8) > at objects.c:328 > > #133 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, > args=0x8af35f0, rho=0x8af3660, callrho=0x8af3660, defrho=0x829d4c0, ans=0xbff08538) > at objects.c:328 > > #202 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, > args=0x8aeca08, rho=0x8aeca78, callrho=0x8aeca78, defrho=0x829d4c0, ans=0xbff0c7b8) > at objects.c:328 > > #271 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, > args=0x8ae7514, rho=0x8ae7584, callrho=0x8ae7584, defrho=0x829d4c0, ans=0xbff10a38) > at objects.c:328 > > #340 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, > args=0x8ade4c0, rho=0x8ade530, callrho=0x8ade530, defrho=0x829d4c0, ans=0xbff14cb8) > at objects.c:328 > > So it would seem that *printing* the unusual POSIXct value is suspect. > Looking at a R-1.8.1 install, we find these definitions in base/R/base: > > print.POSIXct <- function(x, ...) > { > print(format(x, usetz=TRUE), ...) > invisible(x) > } > > print.POSIXlt <- function(x, ...) > { > print(format(x, usetz=TRUE), ...) > invisible(x) > } > > However, looking at the 2.1.0 src file > R-2.1.0/src/library/base/R/datetime.R, we find > > print.POSIXct <- function(x, ...) > { > print(format(x, usetz=TRUE, ...), ...) > invisible(x) > } > > print.POSIXlt <- function(x, ...) > { > print(format(x, usetz=TRUE), ...) > invisible(x) > } > > Note the suspicious definition of print.POSIXct using *two* sets of > ellipses, and that the print.POSIXct and print.POSIXlt definitions no > longer match. > > /Jskud > > --please do not edit the information below-- > > Version: > platform = i686-pc-linux-gnu > arch = i686 > os = linux-gnu > system = i686, linux-gnu > status > major = 2 > minor = 1.0 > year = 2005 > month = 04 > day = 18 > language = R > > [] > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >-- Brian D. Ripley, ripley@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
Prof Brian Ripley
2005-Apr-30 12:19 UTC
(PR#7826) [Rd] segfault during build of 2.1.0 on RH9; print.POSIXct
I've now tested our one remaining RH9 system (built from the sources), and that behaves exactly as FC3. Something is wrong with Jskud@jskud.com's system or its build, not RH9 nor R generically. I've put a workaround in R-patched, but ultimately cycles in inheritance are always possible and the expressions/ppsize limits are there to catch those. On Sat, 30 Apr 2005 ripley@stats.ox.ac.uk wrote:> 1) Why did you submit this *twice*, as PR#7826 and PR#7827? Please don't > be so careless of the volunteers' time. > > 2) > print.POSIXct > function (x, ...) > { > print(format(x, usetz = TRUE, ...), ...) > invisible(x) > } > > is definitely *not* implicated. (Use of ... in two places is correct.) > > 3) On FC3: > >> unusual_and_faults > Error: protect(): protection stack overflow >> format(unusual_and_faults) > Error: protect(): protection stack overflow >> as.POSIXlt(unusual_and_faults) > Error: protect(): protection stack overflow > > which is what should happen. It looks like RH9 has an inadequate stack > size for the new recursion limits of R 2.1.0. This is nothing whatsoever > to do with print.POSIXct. > > The problem is in fact in c.POSIXct which is not checking its arguments. > > > On Sat, 30 Apr 2005 Jskud@jskud.com wrote: > >> In attempting to build R using >> >> rpmbuild --rebuild R-2.1.0-0.fdr.2.fc3.src.rpm >> >> on a fairly up-to-date RedHat 9 system (that is, with patches installed >> through May 1 2004), it failed at the make check-all step. >> >> The problem was reproducible by going into the tests directory and >> >> make test-Segfault >> >> The last lines of the saved file no-segfault.Rout.fail are >> >>>> ## c.POSIXct : >>>> f <- get("c.POSIXct", pos = 'package:base') >>>> f() >>> character(0) >>>> f(NULL) >>> character(0) >>>> f(,NULL) >>> Error in lapply(list(...), unclass) : argument is missing, with no default >>>> f(NULL,NULL) >>> character(0) >>>> f(list()) >>> character(0) >>>> f(l0) >>> character(0) >> >> I was able to reproduce the problem (a segfault) as the following simple >> transcript demonstrates: >> >> LC_ALL=C SRCDIR=. R_DEFAULT_PACKAGES= ../bin/R --vanilla >> >> R : Copyright 2005, The R Foundation for Statistical Computing >> Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 >> >> R is free software and comes with ABSOLUTELY NO WARRANTY. >> You are welcome to redistribute it under certain conditions. >> Type 'license()' or 'licence()' for distribution details. >> >> R is a collaborative project with many contributors. >> Type 'contributors()' for more information and >> 'citation()' on how to cite R or R packages in publications. >> >> Type 'demo()' for some demos, 'help()' for on-line help, or >> 'help.start()' for a HTML browser interface to help. >> Type 'q()' to quit R. >> >> > unusual_but_ok <- c.POSIXlt(character(0)) >> > unusual_but_ok >> character(0) >> > unusual_and_faults <- c.POSIXct(character(0)) >> > unusual_and_faults >> Segmentation fault >> >> Running this test program under gdb, we find that we're running off the >> end of the stack, with 4222 stack frames showing -- apparently in an >> infinite recursion -- "as.character" shows up every 69 function calls: >> >> #64 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, >> args=0x8af8b00, rho=0x8af8b70, callrho=0x8af8b70, defrho=0x829d4c0, ans=0xbff042b8) >> at objects.c:328 >> >> #133 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, >> args=0x8af35f0, rho=0x8af3660, callrho=0x8af3660, defrho=0x829d4c0, ans=0xbff08538) >> at objects.c:328 >> >> #202 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, >> args=0x8aeca08, rho=0x8aeca78, callrho=0x8aeca78, defrho=0x829d4c0, ans=0xbff0c7b8) >> at objects.c:328 >> >> #271 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, >> args=0x8ae7514, rho=0x8ae7584, callrho=0x8ae7584, defrho=0x829d4c0, ans=0xbff10a38) >> at objects.c:328 >> >> #340 0x080ea1ef in Rf_usemethod (generic=0x81c8b12 "as.character", obj=0x0, call=0x85a04f4, >> args=0x8ade4c0, rho=0x8ade530, callrho=0x8ade530, defrho=0x829d4c0, ans=0xbff14cb8) >> at objects.c:328 >> >> So it would seem that *printing* the unusual POSIXct value is suspect. >> Looking at a R-1.8.1 install, we find these definitions in base/R/base: >> >> print.POSIXct <- function(x, ...) >> { >> print(format(x, usetz=TRUE), ...) >> invisible(x) >> } >> >> print.POSIXlt <- function(x, ...) >> { >> print(format(x, usetz=TRUE), ...) >> invisible(x) >> } >> >> However, looking at the 2.1.0 src file >> R-2.1.0/src/library/base/R/datetime.R, we find >> >> print.POSIXct <- function(x, ...) >> { >> print(format(x, usetz=TRUE, ...), ...) >> invisible(x) >> } >> >> print.POSIXlt <- function(x, ...) >> { >> print(format(x, usetz=TRUE), ...) >> invisible(x) >> } >> >> Note the suspicious definition of print.POSIXct using *two* sets of >> ellipses, and that the print.POSIXct and print.POSIXlt definitions no >> longer match. >> >> /Jskud >> >> --please do not edit the information below-- >> >> Version: >> platform = i686-pc-linux-gnu >> arch = i686 >> os = linux-gnu >> system = i686, linux-gnu >> status >> major = 2 >> minor = 1.0 >> year = 2005 >> month = 04 >> day = 18 >> language = R >> >> [] >> >> ______________________________________________ >> R-devel@stat.math.ethz.ch mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> > > -- > Brian D. Ripley, ripley@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 > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >-- Brian D. Ripley, ripley@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
Jskud@Jskud.com
2005-Apr-30 19:55 UTC
(PR#7826) [Rd] segfault during build of 2.1.0 on RH9; print.POSIXct
Date: Sat, 30 Apr 2005 10:47:06 +0100 (BST) From: Prof Brian Ripley <ripley@stats.ox.ac.uk> Thank you for the rapid and helpful reply. 1) Why did you submit this *twice*, as PR#7826 and PR#7827? Please don't be so careless of the volunteers' time. I noticed that the email I originally sent to R-bugs@R-project.org was timing out while connecting to hypatia.ethz.ch. [129.132.145.15]. Checking the R-project web page, I found that the recommended address is r-bugs@biostat.ku.dk; hence, I resent the email to the recommended address. I did not intend to waste the volunteers' time, nor to annoy any of them, and I'm sorry if that happened. 2) > print.POSIXct function (x, ...) { print(format(x, usetz = TRUE, ...), ...) invisible(x) } is definitely *not* implicated. (Use of ... in two places is correct.) I thought use of ... in two places might be incorrect for two reasons. (1) It would seem to supply the same arguments to both print and format -- it is not clear that all trailing arguments to print.POSIXct should go to both routines. (2) If it is correct to use ... in two places for print.POSIXct, then why not for print.POSIXlt? 3) On FC3: > unusual_and_faults Error: protect(): protection stack overflow > format(unusual_and_faults) Error: protect(): protection stack overflow > as.POSIXlt(unusual_and_faults) Error: protect(): protection stack overflow which is what should happen. It looks like RH9 has an inadequate stack size for the new recursion limits of R 2.1.0. This is nothing whatsoever to do with print.POSIXct. You are correct -- to deal with problems in other software that I use, I had reduced my allowed stack size to 1 MB in my .bashrc, and forgotten about it. Building R (actually, running the tests) requires a larger stack. So it was a user problem, not a RH9 problem. The problem is in fact in c.POSIXct which is not checking its arguments. Sincerely, /Jskud
Reasonably Related Threads
- segfault during build of 2.1.0 on RH9; print.POSIXct implicated (PR#7827)
- segfault during build of 2.1.0 on RH9; print.POSIXct implicated (PR#7826)
- Re: (PR#7826) ... segfault during build of 2.1.0 on RH9; print.POSIXct ...
- (PR#7826) Re: ... print.POSIXct .. infinite recursion
- rdbi segmentation fault (fwd)