From hb at maths.lth.se  Mon Jun 27 16:44:37 2005
From: hb at maths.lth.se (Henrik Bengtsson)
Date: Mon, 27 Jun 2005 16:44:37 +0200
Subject: [Rd] R v2.1.1 for Windows and "non-reproducible" crashes
In-Reply-To: <42C00F6D.3070109@maths.lth.se>
References: <42C00F6D.3070109@maths.lth.se>
Message-ID: <42C010D5.6090509@maths.lth.se>

Henrik Bengtsson wrote:
> Hi,
> 
> R v2.1.1 patched (2005-05-26) for Windows crashes.  The sympotoms are 
> like "memory leakage".  The patched version from two days ago crashes at 
> a different position in R CMD check compared to todays version.

Sorry for being unclear; the "R CMD check" refers to R CMD check for my 
R.oo package and is just an example.

> A "REPRODUCIBLE" EXAMPLE:
> Unfortunately, I cannot create a minimal code example reproducing the 
> crash, but here is at least a simple way to reproduce it:
> 
> 1. Make sure you run R v2.1.1 patched
> 2. Start R
> 3. install.packages("R.oo", contriburl="http://www.maths.lth.se/help/R")
>     [This is a version built with R v2.1.0, because I cannot make the 
> package pass R CMD check on v2.1.1 because of the crashes]
> 4. Cut'n'paste the following example from ?Rdoc to the R prompt:
> library(R.oo)
> author <- "Henrik Bengtsson, \url{http://www.braju.com/R/}"
> rdocFile <- system.file("misc", "Exception.R", package="R.oo")
> file.show(rdocFile)
> destPath <- tempdir()
> Rdoc$compile(rdocFile, destPath=destPath)
> rdFiles <- list.files(destPath, full.names=TRUE)
> print(rdFiles)
> file.show(rdFiles[1])
> file.remove(rdFiles)
> 
> For me it crashes when it gets to the Rdoc$compile() line and Dr. Mingw 
> reports:
> 
> Rterm.exe caused an Access Violation at location 7c911e58 in module 
> ntdll.dll Reading from location 52474f52.
> 
> Registers:
> eax=003efa18 ebx=003e0000 ecx=52474f52 edx=502f3a43 esi=003efa10 
> edi=003efa48
> eip=7c911e58 esp=00228c10 ebp=00228c1c iopl=0         nv up ei pl zr na 
> po nc
> cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000 
> efl=00000246
> 
> Call stack:
> 7C911E58  ntdll.dll:7C911E58  RtlInitializeCriticalSection
> 7C910D5C  ntdll.dll:7C910D5C  wcsncpy
> 77C2C2DE  msvcrt.dll:77C2C2DE  free
> 1004BFB0  R.dll:1004BFB0  do_isseekable
> 1004C051  R.dll:1004C051  con_close
> 1004D33E  R.dll:1004D33E  do_close
> 100A8E41  R.dll:100A8E41  do_internal
> 1008494A  R.dll:1008494A  Rf_eval
> 10085595  R.dll:10085595  Rf_evalList
> 10084993  R.dll:10084993  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100A9361  R.dll:100A9361  do_internal
> 100A99A5  R.dll:100A99A5  Rf_usemethod
> 100A9E1A  R.dll:100A9E1A  do_usemethod
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10051EE9  R.dll:10051EE9  Rf_endcontext
> 1008751F  R.dll:1008751F  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10086305  R.dll:10086305  do_set
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100A9361  R.dll:100A9361  do_internal
> 100A99A5  R.dll:100A99A5  Rf_usemethod
> 100A9E1A  R.dll:100A9E1A  do_usemethod
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10086305  R.dll:10086305  do_set
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 10084671  R.dll:10084671  Rf_eval
> 1008487C  R.dll:1008487C  Rf_eval
> 10084671  R.dll:10084671  Rf_eval
> 1008487C  R.dll:1008487C  Rf_eval
> 10084671  R.dll:10084671  Rf_eval
> 1008487C  R.dll:1008487C  Rf_eval
> 100852A5  R.dll:100852A5  Rf_evalListKeepMissing
> 100853DD  R.dll:100853DD  do_return
> 1008494A  R.dll:1008494A  Rf_eval
> 10084671  R.dll:10084671  Rf_eval
> 1008487C  R.dll:1008487C  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10086305  R.dll:10086305  do_set
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10086305  R.dll:10086305  do_set
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 10086A18  R.dll:10086A18  do_for
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100A9361  R.dll:100A9361  do_internal
> 100A99A5  R.dll:100A99A5  Rf_usemethod
> 100A9E1A  R.dll:100A9E1A  do_usemethod
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10086305  R.dll:10086305  do_set
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10084671  R.dll:10084671  Rf_eval
> 1008487C  R.dll:1008487C  Rf_eval
> 10085595  R.dll:10085595  Rf_evalList
> 100A8F0F  R.dll:100A8F0F  do_internal
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10085012  R.dll:10085012  do_eval
> 100A8E41  R.dll:100A8E41  do_internal
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100866A2  R.dll:100866A2  do_while
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 10086A18  R.dll:10086A18  do_for
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 10086305  R.dll:10086305  do_set
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 10086A18  R.dll:10086A18  do_for
> 1008494A  R.dll:1008494A  Rf_eval
> 100863D5  R.dll:100863D5  do_begin
> 1008494A  R.dll:1008494A  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 100875AB  R.dll:100875AB  Rf_applyClosure
> 100846E0  R.dll:100846E0  Rf_eval
> 1009D5E6  R.dll:1009D5E6  Rf_ReplIteration
> 1009D717  R.dll:1009D717  Rf_ReplIteration
> 1009D997  R.dll:1009D997  run_Rmainloop
> 0040144C  Rterm.exe:0040144C
> 004012C5  Rterm.exe:004012C5
> 004016BA  Rterm.exe:004016BA
> 004011E7  Rterm.exe:004011E7
> 00401238  Rterm.exe:00401238
> 7C816D4F  kernel32.dll:7C816D4F  RegisterWaitForInputIdle
> 
> Sometimes it just give an error about an invalid regular expression; 
> then rerun the line for it to crash, e.g.
> 
>  > Rdoc$compile(rdocFile, destPath=destPath)
> Loading required package: tools
> Error in regexpr(pattern, text, extended, fixed, useBytes) :
>          invalid regular expression '^@classhierarchy'
> 
> Then redo the Rdoc$compile() line and R will crash.
> 
> Also, note that the regular expression pattern in the error report from 
> regexpr() about "invalid regular expression '^@alias'" is valid, because 
> trying it in R you get
> 
>  > regexpr("^@classhierarchy", "@classhierarchy")
> [1] 1
> attr(,"match.length")
> [1] 15
> 
> I have also received messages about "invalid regular expression ''", but 
> I am sure I do not use empty regular expressions anywhere.
> 
> I am pretty sure it is not the R.oo package itself, because nothing much 
> has changed and the package has passed the R CMD check for many R 
> versions including R v2.1.0 patched (2005-05-09). The crashed to not 
> occur on the R v2.1.0 patched version.
> 
> 
> Has anyone else noticed this?  Can you reproduce the above, or is it 
> just my Windows installation? If I figure out more on this myself, I'll 
> get back to you.
> 
> My system is Windows XP Pro English SP2 with
> 
>  > R.Version()
> $platform
> [1] "i386-pc-mingw32"
> 
> $arch
> [1] "i386"
> 
> $os
> [1] "mingw32"
> 
> $system
> [1] "i386, mingw32"
> 
> $status
> [1] "Patched"
> 
> $major
> [1] "2"
> 
> $minor
> [1] "1.1"
> 
> $year
> [1] "2005"
> 
> $month
> [1] "06"
> 
> $day
> [1] "26"
> 
> $language
> [1] "R"
> 
> Best
> 
> Henrik
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
>



[Rd] R v2.1.1 for Windows and "non-reproducible" crashes
Henrik Bengtsson