[datatable-help] data.table crashes R session

Chris Neff caneff at gmail.com
Mon Jan 2 15:31:19 CET 2012


I worked with Matthew a lot and we found that the code I managed to
give him would not crash on 32-bit, but would on 64-bit (on both 2.12
and 2.14).  It looks like you are running 64-bit as well, so you may
very well be seeing the same issue I am.  I'll let him respond with
more though :)

On 2 January 2012 03:40, Christoph Jäckel <christoph.jaeckel at wi.tum.de> wrote:
> Note: I posted this on Nabble before, but it keeps telling me that it has
> not been accepted by the mailing list. So this might be a duplicate.
>
> Hi together,
>
> I recently encountered severe problems with R (see my post on stackoverflow
> here: http://stackoverflow.com/questions/8616862/r-terminates-with-error-message-this-application-has-requested-the-runtime-to-t).
> Spending the whole day digging further into the problem, I was able to
> produce rather minimal code that crashes my RStudio session. I confirmed
> this on two different machines (see details at the end).  If I run this code
> in my Linux Terminal, I get the following error:
>
>  *** caught segfault ***
> address (nil), cause 'unknown'
>
> Traceback:
>  1: as.data.frame.Date(x[[i]], optional = TRUE)
>  2: as.data.frame(x[[i]], optional = TRUE)
>  3: data.frame(ID = rep(1:100, each = n/100), intTime = rep(1:(n/100),
> times = 100), FYE = lDate1 + 1:n)
>
> So it looks like a similar problem  to caneff's
> problem: http://r.789695.n4.nabble.com/Random-segfaults-td4195472i20.html
>
> So my two questions are:
> 1. Can you confirm this? (Sometimes, I have to run the code a couple of
> times to get R to crash)
> 2. What is the cause? (Interestingly, I need to add the line DT[, reportDate
> := NA] to get the code breaking, although this line seems completely
> irrelevant for the further computations. For me, R closes when the last line
> is run.)
>
> Rather minimal code:
>
> get_diff_month <- function(actualDate, baseDate) {
>
>   #Because data.table also has a month function
>   return(month(actualDate) - month(baseDate) + 12*(year(actualDate) -
> year(baseDate)))
> }
> library(data.table)
>
> n <- 100000
> lDate1 <- as.Date("1jan1900", "%d%b%Y")#dmy("1Jan1900")
> lDate2 <- as.Date("1jan1901", "%d%b%Y")#dmy("1Jan1901")
> df <- data.frame(ID = rep(1:100, each=n/100),
>                  intTime = rep(1:(n/100), times=100),
>                  FYE=lDate1 + 1:n)
> DT <- as.data.table(df)
> DT[rbinom(n, size=1, prob=0.05)==1, FYE:=NA]
> DT[, reportDate := NA] #Bad line: comment it out and nothing breaks!
> DT[, intFYE      := get_diff_month(FYE, as.Date("1jan1900", "%d%b%Y"))]
> intDT <- DT[ , list(FYE, intTime, ID)]
> newDates <- intDT[, intTime] - 1
> intDT[, intTime := newDates]
> #Set keys
> key(DT)    <- c("ID", "intTime")
> key(intDT) <- c("ID", "intTime")
> DT <- merge(DT, intDT, all.x=TRUE)
> DT[, intFYE_Next := get_diff_month(FYE.y, as.Date("1jan1900", "%d%b%Y"))]
>
> sessionInfo() 1:
>
> R version 2.13.2 (2011-09-30)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
> LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=C
>
>  [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C
>          LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] data.table_1.7.7
>
> loaded via a namespace (and not attached):
> [1] tools_2.13.2
>
> sessionInfo() 2:
>
>
> R version 2.14.0 (2011-10-31)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] data.table_1.7.7
>
> loaded via a namespace (and not attached):
> [1] tools_2.14.0
>
> Thanks Christoph
>
> --
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Christoph Jäckel (Dipl.-Kfm.)
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Research Assistant
>
> Chair for Financial Management and Capital Markets | Lehrstuhl für
> Finanzmanagement und Kapitalmärkte
>
> TUM School of Management | Technische Universität München
>
> Arcisstr. 21 | D-80333 München | Germany
>
> Mailto: christoph.jaeckel at wi.tum.de | Web: www.fm.wi.tum.de
>
> Phone: +49 89 289 25487 | Fax: +49 89 289 25488
>
>
>
> Head of Chair:
>
> Univ.-Prof. Dr. Christoph Kaserer
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> E-Mail Disclaimer
>
> Der Inhalt dieser E-Mail ist vertraulich und ausschliesslich
> fuer den bezeichneten Adressaten bestimmt. Wenn Sie nicht
> der vorgesehene Adressat dieser E-Mail oder dessen Vertreter
> sein sollten, so beachten Sie bitte, dass jede Form der
> Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder
> Weitergabe des Inhalts dieser E-Mail unzulaessig ist. Wir
> bitten Sie, sich in diesem Fall mit dem Absender der E-Mail
> in Verbindung zu setzen.
>
> The information contained in this email is confidential. It is
> intended solely for the addressee. Access to this email by
> anyone else is unauthorized if you are not the intended
> recipient, any form of disclosure, reproduction, distribution
> or any action taken or refrained from in reliance on it, is
> prohibited and may be unlawful. Please notify the sender
> immediately.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help


More information about the datatable-help mailing list