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