From henrik.bengtsson at gmail.com  Mon May  2 04:08:20 2016
From: henrik.bengtsson at gmail.com (Henrik Bengtsson)
Date: Sun, 1 May 2016 19:08:20 -0700
Subject: [Rd] Closing a fifo() on Windows core dumps R (3.2.5,
	3.3.0 RC and devel)
Message-ID: <CAFDcVCR4yA+QP3AS0J_7bB-xa1Y=RGjr14OPEkgNPPaKtM=_gg@mail.gmail.com>

The following core dumps R 3.2.5, R 3.3.0 RC and R devel on Windows.
I have tried to use a minimal setup (for all versions tested), i.e.

C:\> cd C:\
C:\> set PATH=C:\PROGRA~1\R\R-33~1.0RC\bin
C:\> set R_DEFAULT_PACKAGES=base

C:\> R --quiet --vanilla
> close(fifo("foo.tmp", open="wb"))
[core dump]


C:\> R --quiet --vanilla
> con <- fifo('foo.tmp', open='wb')
> print(con)
description       class        mode        text      opened    can read
       "\v"      "fifo"        "wb"      "text"    "opened"        "no"
  can write
      "yes"
> close(con)


C:\>R --quiet --vanilla -e "close(fifo('foo.tmp', open='wb'))"
> close(fifo('foo.tmp', open='wb'))
[core dump]


C:\>R --quiet --vanilla -e "fh <- fifo('foo.tmp', open='wb');
print(fh); close(fh)"
> fh <- fifo('foo.tmp', open='wb'); print(fh); close(fh)
description       class        mode        text      opened    can read
     "\016"      "fifo"        "wb"      "text"    "opened"        "no"
  can write
      "yes"
[core dump]

C:\>R --quiet --vanilla -e "fifo('foo.tmp', open='wb'); closeAllConnections()"
> fifo('foo.tmp', open='wb'); closeAllConnections()
description       class        mode        text      opened    can read
     "\016"      "fifo"        "wb"      "text"    "opened"        "no"
  can write
      "yes"
[core dump]

C:\>Rscript --vanilla -e "close(fifo('foo.tmp', open='wb'))"
[core dump]

C:\> Rscript --vanilla -e "con <- fifo('foo.tmp', open='wb');
print(con); close(con)"
description       class        mode        text      opened    can read
       "\f"      "fifo"        "wb"      "text"    "opened"        "no"
  can write
      "yes"
[core dump]


I doesn't core dump every time, but quite often. When I get it to core
dump ones I can often repeat it several times.  And when it doesn't
core dump, it seems to work for quite a while.

Note the random values of the `description` when it core dumps
(spurious memory mapping?).  These are reproducible between core dumps
and I even seen then across different cmd.exe sessions.  When it does
*not* core dump, I typically see "foo.tmp" (as expected), but I've
also seen "con" (sic!).


I've got it to core dump with the following versions of R:

C:\>Rscript -e "utils::sessionInfo()"
R version 3.2.5 (2016-04-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

C:\>R --version
R version 3.3.0 RC (2016-04-28 r70564) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

all with session info:

C:\>Rscript --vanilla -e "utils::sessionInfo()"
R version { version }
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] base

loaded via a namespace (and not attached):
[1] utils_3.3.0



Can some else reproduce this?  I'd be happy to do a formal bug report.


Thanks

Henrik



[Rd] Closing a fifo() on Windows core dumps R (3.2.5, 3.3.0 RC and devel)
Henrik Bengtsson