Intermittent crashes with inset `[<-` command

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Intermittent crashes with inset `[<-` command

R devel mailing list
The following code crashes after about 300 iterations on my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.  
Others have duplicated this (see https://github.com/tidyverse/magrittr/issues/190 if necessary), but I don't know how machine/OS-dependent it may be.  
If it doesn't crash for you, please try increasing the length of the x vector.

Substituting the commented-out line for the one below it works correctly (prints out 1:1000 and ends normally) every time.

x <- 1:200000
y <- rep(letters[1:5], length(x) / 5L)
for (i in 1:1000) {
  # x[y == 'a'] <- x[y == 'b']
  x <- `[<-`(x, y == 'a', x[y == 'b'])
  cat(i, '')
}
cat('\n')

The point of using this syntax is to make it work better with pipes, but the errors occur without pipes or magrittr.

Thank you for your help!

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Gabriel Becker-2
Hi Brian,

I don't have a windows machine, but on a modern macbook pro I'm not able to
get this to crash in 3.5.1 or a very recent built-from-source R-devel.  I
increased the length of x by 2 orders of magnitude but that just made the
loop take a lot longer to successfully run in both R versions i tested.

So seems like there is some OS/machine dependency at work here (?).

Best,
~G

On Wed, Feb 27, 2019 at 12:01 AM Brian Montgomery via R-devel <
[hidden email]> wrote:

> The following code crashes after about 300 iterations on
> my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> Others have duplicated this (see
> https://github.com/tidyverse/magrittr/issues/190 if necessary), but I
> don't know how machine/OS-dependent it may be.
> If it doesn't crash for you, please try increasing the length of the x
> vector.
>
> Substituting the commented-out line for the one below it works correctly
> (prints out 1:1000 and ends normally) every time.
>
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
>   # x[y == 'a'] <- x[y == 'b']
>   x <- `[<-`(x, y == 'a', x[y == 'b'])
>   cat(i, '')
> }
> cat('\n')
>
> The point of using this syntax is to make it work better with pipes, but
> the errors occur without pipes or magrittr.
>
> Thank you for your help!
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Serguei Sokol
In reply to this post by R devel mailing list
On 26/02/2019 05:18, Brian Montgomery via R-devel wrote:
> The following code crashes after about 300 iterations on my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> Others have duplicated this (see https://github.com/tidyverse/magrittr/issues/190 if necessary), but I don't know how machine/OS-dependent it may be.
It crashes too on my Mageia6 (RPM based Linux distribution):
  184 185 186 187
  *** caught segfault ***
address 0x700000002, cause 'memory not mapped'

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

The crash can happen at different moments, sometimes after i=187 like in
the example above, sometimes after i=915. The error is not always
segfault. It can also be

915 Error in `[<-`(x, y == "a", x[y == "b"]) : replacement has length zero

or

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Error in
`[<-`(x, y == "a", x[y == "b"]) :
   types (de raw a integer) incompatibles dans l'ajustement
d'affectation de type

(sorry, this crash was in french locale)

Hoping this helps.
Serguei.

 >  sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Mageia 6

Matrix products: default
BLAS/LAPACK: /home/opt/OpenBLAS/lib/libopenblas_sandybridge-r0.3.3.so

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods base

loaded via a namespace (and not attached):
[1] compiler_3.5.2

> If it doesn't crash for you, please try increasing the length of the x vector.
>
> Substituting the commented-out line for the one below it works correctly (prints out 1:1000 and ends normally) every time.
>
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
>    # x[y == 'a'] <- x[y == 'b']
>    x <- `[<-`(x, y == 'a', x[y == 'b'])
>    cat(i, '')
> }
> cat('\n')
>
> The point of using this syntax is to make it work better with pipes, but the errors occur without pipes or magrittr.
>
> Thank you for your help!
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Iñaki Ucar
On Wed, 27 Feb 2019 at 09:51, Serguei Sokol <[hidden email]> wrote:
>
> On 26/02/2019 05:18, Brian Montgomery via R-devel wrote:
> > The following code crashes after about 300 iterations on my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> > Others have duplicated this (see https://github.com/tidyverse/magrittr/issues/190 if necessary), but I don't know how machine/OS-dependent it may be.
> It crashes too on my Mageia6 (RPM based Linux distribution):
>   184 185 186 187
>   *** caught segfault ***
> address 0x700000002, cause 'memory not mapped'

I can reproduce it too. This is the output from valgrind (sessionInfo below):

==3296== Invalid read of size 1
==3296==    at 0x4A2D7F7: UnknownInlinedFun (Rinlinedfuns.h:542)
==3296==    by 0x4A2D7F7: VectorAssign (subassign.c:658)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafab90 is 0 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 1
==3296==    at 0x4A2E2C0: UnknownInlinedFun (Rinlinedfuns.h:189)
==3296==    by 0x4A2E2C0: UnknownInlinedFun (Rinlinedfuns.h:554)
==3296==    by 0x4A2E2C0: VectorAssign (subassign.c:658)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafab90 is 0 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 8
==3296==    at 0x4A2E2C9: UnknownInlinedFun (Rinlinedfuns.h:189)
==3296==    by 0x4A2E2C9: UnknownInlinedFun (Rinlinedfuns.h:554)
==3296==    by 0x4A2E2C9: VectorAssign (subassign.c:658)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafabb0 is 32 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 1
==3296==    at 0x4A2CCC0: SubassignTypeFix (subassign.c:318)
==3296==    by 0x4A2D8F8: VectorAssign (subassign.c:666)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafab90 is 0 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 1
==3296==    at 0x4A2D858: UnknownInlinedFun (Rinlinedfuns.h:542)
==3296==    by 0x4A2D858: VectorAssign (subassign.c:672)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafab90 is 0 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 1
==3296==    at 0x4A2DBA0: UnknownInlinedFun (Rinlinedfuns.h:189)
==3296==    by 0x4A2DBA0: UnknownInlinedFun (Rinlinedfuns.h:554)
==3296==    by 0x4A2DBA0: VectorAssign (subassign.c:672)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafab90 is 0 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 8
==3296==    at 0x4A2DBA9: UnknownInlinedFun (Rinlinedfuns.h:189)
==3296==    by 0x4A2DBA9: UnknownInlinedFun (Rinlinedfuns.h:554)
==3296==    by 0x4A2DBA9: VectorAssign (subassign.c:672)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafabb0 is 32 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 1
==3296==    at 0x4A2F9C2: UnknownInlinedFun (Rinlinedfuns.h:381)
==3296==    by 0x4A2F9C2: VectorAssign (subassign.c:710)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafab90 is 0 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==
==3296== Invalid read of size 4
==3296==    at 0x4A2F9C7: UnknownInlinedFun (Rinlinedfuns.h:381)
==3296==    by 0x4A2F9C7: VectorAssign (subassign.c:710)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:258)
==3296==    by 0x49B5131: Rf_ReplIteration (main.c:198)
==3296==    by 0x49B54F0: R_ReplConsole (main.c:308)
==3296==    by 0x49B55AF: run_Rmainloop (main.c:1082)
==3296==    by 0x1090AE: main (Rmain.c:29)
==3296==  Address 0x1dafabc0 is 48 bytes inside a block of size 160,048 free'd
==3296==    at 0x4839A0C: free (vg_replace_malloc.c:540)
==3296==    by 0x49BCA56: ReleaseLargeFreeVectors (memory.c:1055)
==3296==    by 0x49BCA56: RunGenCollect (memory.c:1825)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2998)
==3296==    by 0x49BCA56: R_gc_internal (memory.c:2964)
==3296==    by 0x49BFB2C: Rf_allocVector3 (memory.c:2682)
==3296==    by 0x49C09FC: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x49C09FC: R_alloc (memory.c:2197)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:575)
==3296==    by 0x4A377F5: logicalSubscript (subscript.c:503)
==3296==    by 0x4A3A8D3: Rf_makeSubscript (subscript.c:994)
==3296==    by 0x4A2D63D: VectorAssign (subassign.c:656)
==3296==    by 0x4A30540: do_subassign_dflt (subassign.c:1641)
==3296==    by 0x4A338F2: do_subassign (subassign.c:1571)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==  Block was alloc'd at
==3296==    at 0x483880B: malloc (vg_replace_malloc.c:309)
==3296==    by 0x49C0031: Rf_allocVector3 (memory.c:2713)
==3296==    by 0x4A3B041: UnknownInlinedFun (Rinlinedfuns.h:577)
==3296==    by 0x4A3B041: Rf_ExtractSubset (subset.c:115)
==3296==    by 0x4A3DA8A: VectorSubset (subset.c:198)
==3296==    by 0x4A3DA8A: do_subset_dflt (subset.c:823)
==3296==    by 0x4A3FCAA: do_subset (subset.c:661)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)
==3296==    by 0x4989600: Rf_evalListKeepMissing (eval.c:2955)
==3296==    by 0x4A3390B: R_DispatchOrEvalSP (subassign.c:1535)
==3296==    by 0x4A3390B: do_subassign (subassign.c:1567)
==3296==    by 0x49769A1: bcEval (eval.c:6795)
==3296==    by 0x498B415: R_compileAndExecute (eval.c:1407)
==3296==    by 0x498B985: do_for (eval.c:2185)
==3296==    by 0x49848A8: Rf_eval (eval.c:691)

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 29 (Twenty Nine)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
[1] LC_CTYPE=es_ES.UTF-8       LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=es_ES.UTF-8
[5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=es_ES.UTF-8       LC_NAME=C
[9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.5.2

--
Iñaki

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Rui Barradas
In reply to this post by Serguei Sokol
Hello,

I can also reproduce this, R 3.5.2 on Ubuntu 18.04 LTS.


First run gives error after 148.

After 148:

Error in `[<-`(x, y == "a", x[y == "b"]) :
   substituto tem comprimento zero
Execução interrompida

Translation:

replacement has length zero
Execution stopped


Second run gives a different error, I changed the script to start with a
sessionInfo() instruction, everything else is the same as in the OP.

After 180:

  *** caught segfault ***
address 0x700000002, cause 'memory not mapped'
An irrecoverable exception occurred. R is aborting now ...


Several runs with or without the sessionInfo() always give the two
different errors above.

The sessionInfo() was the following.

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
  [1] LC_CTYPE=pt_PT.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=pt_PT.UTF-8        LC_COLLATE=pt_PT.UTF-8
  [5] LC_MONETARY=pt_PT.UTF-8    LC_MESSAGES=pt_PT.UTF-8
  [7] LC_PAPER=pt_PT.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=pt_PT.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.5.2


Hope this helps,

Rui Barradas


Às 08:46 de 27/02/2019, Serguei Sokol escreveu:

> On 26/02/2019 05:18, Brian Montgomery via R-devel wrote:
>> The following code crashes after about 300 iterations on
>> my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
>> Others have duplicated this
>> (see https://github.com/tidyverse/magrittr/issues/190 if necessary),
>> but I don't know how machine/OS-dependent it may be.
> It crashes too on my Mageia6 (RPM based Linux distribution):
>   184 185 186 187
>   *** caught segfault ***
> address 0x700000002, cause 'memory not mapped'
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
>
> The crash can happen at different moments, sometimes after i=187 like in
> the example above, sometimes after i=915. The error is not always
> segfault. It can also be
>
> 915 Error in `[<-`(x, y == "a", x[y == "b"]) : replacement has length zero
>
> or
>
> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Error in
> `[<-`(x, y == "a", x[y == "b"]) :
>    types (de raw a integer) incompatibles dans l'ajustement
> d'affectation de type
>
> (sorry, this crash was in french locale)
>
> Hoping this helps.
> Serguei.
>
>  >  sessionInfo()
> R version 3.5.2 (2018-12-20)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Mageia 6
>
> Matrix products: default
> BLAS/LAPACK: /home/opt/OpenBLAS/lib/libopenblas_sandybridge-r0.3.3.so
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods base
>
> loaded via a namespace (and not attached):
> [1] compiler_3.5.2
>
>> If it doesn't crash for you, please try increasing the length of the x
>> vector.
>>
>> Substituting the commented-out line for the one below it works
>> correctly (prints out 1:1000 and ends normally) every time.
>>
>> x <- 1:200000
>> y <- rep(letters[1:5], length(x) / 5L)
>> for (i in 1:1000) {
>>    # x[y == 'a'] <- x[y == 'b']
>>    x <- `[<-`(x, y == 'a', x[y == 'b'])
>>    cat(i, '')
>> }
>> cat('\n')
>>
>> The point of using this syntax is to make it work better with pipes,
>> but the errors occur without pipes or magrittr.
>>
>> Thank you for your help!
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

R devel mailing list
In reply to this post by Gabriel Becker-2
Valgrind (without gctorture) reports memory misuse:

% R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18"
...
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
+   # x[y == 'a'] <- x[y == 'b']
+   x <- `[<-`(x, y == 'a', x[y == 'b'])
+   cat(i, '')
+ }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
29 30 31 32 33 34 35 36 37 ==4711== Invalid read of size 1
==4711==    at 0x501A40F: Rf_xlength (Rinlinedfuns.h:542)
==4711==    by 0x501A40F: VectorAssign (subassign.c:658)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
==4711== Invalid read of size 8
==4711==    at 0x501A856: XLENGTH_EX (Rinlinedfuns.h:189)
==4711==    by 0x501A856: Rf_xlength (Rinlinedfuns.h:554)
==4711==    by 0x501A856: VectorAssign (subassign.c:658)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3abb0 is 32 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
==4711== Invalid read of size 1
==4711==    at 0x501997E: SubassignTypeFix (subassign.c:318)
==4711==    by 0x501A4A2: VectorAssign (subassign.c:666)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
==4711== Invalid read of size 1
==4711==    at 0x501A4B4: Rf_xlength (Rinlinedfuns.h:542)
==4711==    by 0x501A4B4: VectorAssign (subassign.c:672)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
==4711== Invalid read of size 8
==4711==    at 0x501A573: XLENGTH_EX (Rinlinedfuns.h:189)
==4711==    by 0x501A573: Rf_xlength (Rinlinedfuns.h:554)
==4711==    by 0x501A573: VectorAssign (subassign.c:672)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3abb0 is 32 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
==4711== Invalid read of size 1
==4711==    at 0x501C582: INTEGER_ELT (Rinlinedfuns.h:381)
==4711==    by 0x501C582: VectorAssign (subassign.c:710)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
==4711== Invalid read of size 4
==4711==    at 0x501C587: INTEGER_ELT (Rinlinedfuns.h:381)
==4711==    by 0x501C587: VectorAssign (subassign.c:710)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Address 0x19b3abc0 is 48 bytes inside a block of size 160,048
free'd
==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
==4711==    by 0x5020100: do_subassign (subassign.c:1571)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==  Block was alloc'd at
==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
==4711==    by 0x502BE90: do_subset (subset.c:661)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
==4711==    by 0x4F66398: bcEval (eval.c:6795)
==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
==4711==    by 0x4F7DA70: do_for (eval.c:2185)
==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
==4711==    by 0x40075A: main (Rmain.c:29)
==4711==
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
...

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Wed, Feb 27, 2019 at 12:31 AM Gabriel Becker <[hidden email]>
wrote:

> Hi Brian,
>
> I don't have a windows machine, but on a modern macbook pro I'm not able to
> get this to crash in 3.5.1 or a very recent built-from-source R-devel.  I
> increased the length of x by 2 orders of magnitude but that just made the
> loop take a lot longer to successfully run in both R versions i tested.
>
> So seems like there is some OS/machine dependency at work here (?).
>
> Best,
> ~G
>
> On Wed, Feb 27, 2019 at 12:01 AM Brian Montgomery via R-devel <
> [hidden email]> wrote:
>
> > The following code crashes after about 300 iterations on
> > my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> > Others have duplicated this (see
> > https://github.com/tidyverse/magrittr/issues/190 if necessary), but I
> > don't know how machine/OS-dependent it may be.
> > If it doesn't crash for you, please try increasing the length of the x
> > vector.
> >
> > Substituting the commented-out line for the one below it works correctly
> > (prints out 1:1000 and ends normally) every time.
> >
> > x <- 1:200000
> > y <- rep(letters[1:5], length(x) / 5L)
> > for (i in 1:1000) {
> >   # x[y == 'a'] <- x[y == 'b']
> >   x <- `[<-`(x, y == 'a', x[y == 'b'])
> >   cat(i, '')
> > }
> > cat('\n')
> >
> > The point of using this syntax is to make it work better with pipes, but
> > the errors occur without pipes or magrittr.
> >
> > Thank you for your help!
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Travers Ching
On an azure centos VM, I can reproduce this bug which reports either:

 *** caught segfault ***
address 0x70000006a, cause 'memory not mapped' (crash)

Or

incompatible types (from builtin to integer) in subassignment type fix
(no crash)

Like Gabriel, I could not reproduce the bug on a mac laptop.  Both R
versions 3.5.1.

Travers

On Wed, Feb 27, 2019 at 9:08 AM William Dunlap via R-devel
<[hidden email]> wrote:

>
> Valgrind (without gctorture) reports memory misuse:
>
> % R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18"
> ...
> > x <- 1:200000
> > y <- rep(letters[1:5], length(x) / 5L)
> > for (i in 1:1000) {
> +   # x[y == 'a'] <- x[y == 'b']
> +   x <- `[<-`(x, y == 'a', x[y == 'b'])
> +   cat(i, '')
> + }
> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
> 29 30 31 32 33 34 35 36 37 ==4711== Invalid read of size 1
> ==4711==    at 0x501A40F: Rf_xlength (Rinlinedfuns.h:542)
> ==4711==    by 0x501A40F: VectorAssign (subassign.c:658)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> ==4711== Invalid read of size 8
> ==4711==    at 0x501A856: XLENGTH_EX (Rinlinedfuns.h:189)
> ==4711==    by 0x501A856: Rf_xlength (Rinlinedfuns.h:554)
> ==4711==    by 0x501A856: VectorAssign (subassign.c:658)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3abb0 is 32 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> ==4711== Invalid read of size 1
> ==4711==    at 0x501997E: SubassignTypeFix (subassign.c:318)
> ==4711==    by 0x501A4A2: VectorAssign (subassign.c:666)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> ==4711== Invalid read of size 1
> ==4711==    at 0x501A4B4: Rf_xlength (Rinlinedfuns.h:542)
> ==4711==    by 0x501A4B4: VectorAssign (subassign.c:672)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> ==4711== Invalid read of size 8
> ==4711==    at 0x501A573: XLENGTH_EX (Rinlinedfuns.h:189)
> ==4711==    by 0x501A573: Rf_xlength (Rinlinedfuns.h:554)
> ==4711==    by 0x501A573: VectorAssign (subassign.c:672)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3abb0 is 32 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> ==4711== Invalid read of size 1
> ==4711==    at 0x501C582: INTEGER_ELT (Rinlinedfuns.h:381)
> ==4711==    by 0x501C582: VectorAssign (subassign.c:710)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> ==4711== Invalid read of size 4
> ==4711==    at 0x501C587: INTEGER_ELT (Rinlinedfuns.h:381)
> ==4711==    by 0x501C587: VectorAssign (subassign.c:710)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Address 0x19b3abc0 is 48 bytes inside a block of size 160,048
> free'd
> ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==  Block was alloc'd at
> ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> ==4711==    by 0x502BE90: do_subset (subset.c:661)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> ==4711==    by 0x40075A: main (Rmain.c:29)
> ==4711==
> 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
> ...
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Wed, Feb 27, 2019 at 12:31 AM Gabriel Becker <[hidden email]>
> wrote:
>
> > Hi Brian,
> >
> > I don't have a windows machine, but on a modern macbook pro I'm not able to
> > get this to crash in 3.5.1 or a very recent built-from-source R-devel.  I
> > increased the length of x by 2 orders of magnitude but that just made the
> > loop take a lot longer to successfully run in both R versions i tested.
> >
> > So seems like there is some OS/machine dependency at work here (?).
> >
> > Best,
> > ~G
> >
> > On Wed, Feb 27, 2019 at 12:01 AM Brian Montgomery via R-devel <
> > [hidden email]> wrote:
> >
> > > The following code crashes after about 300 iterations on
> > > my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> > > Others have duplicated this (see
> > > https://github.com/tidyverse/magrittr/issues/190 if necessary), but I
> > > don't know how machine/OS-dependent it may be.
> > > If it doesn't crash for you, please try increasing the length of the x
> > > vector.
> > >
> > > Substituting the commented-out line for the one below it works correctly
> > > (prints out 1:1000 and ends normally) every time.
> > >
> > > x <- 1:200000
> > > y <- rep(letters[1:5], length(x) / 5L)
> > > for (i in 1:1000) {
> > >   # x[y == 'a'] <- x[y == 'b']
> > >   x <- `[<-`(x, y == 'a', x[y == 'b'])
> > >   cat(i, '')
> > > }
> > > cat('\n')
> > >
> > > The point of using this syntax is to make it work better with pipes, but
> > > the errors occur without pipes or magrittr.
> > >
> > > Thank you for your help!
> > >
> > > ______________________________________________
> > > [hidden email] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
> > >
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Travers Ching
Some testing:

Adding `gc()` inside the for loop prevented a crash for 10,000+
iterations, whereas adding `Sys.sleep(.2)` (which takes longer) did
not.  I couldn't wrap my head around the `vectorAssign` source code,
but I suspect it is a matter of an intermediate object not being
protected and being gc'ed.  Hope that helps someone....

Travers


Travers

On Wed, Feb 27, 2019 at 11:48 AM Travers Ching <[hidden email]> wrote:

>
> On an azure centos VM, I can reproduce this bug which reports either:
>
>  *** caught segfault ***
> address 0x70000006a, cause 'memory not mapped' (crash)
>
> Or
>
> incompatible types (from builtin to integer) in subassignment type fix
> (no crash)
>
> Like Gabriel, I could not reproduce the bug on a mac laptop.  Both R
> versions 3.5.1.
>
> Travers
>
> On Wed, Feb 27, 2019 at 9:08 AM William Dunlap via R-devel
> <[hidden email]> wrote:
> >
> > Valgrind (without gctorture) reports memory misuse:
> >
> > % R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18"
> > ...
> > > x <- 1:200000
> > > y <- rep(letters[1:5], length(x) / 5L)
> > > for (i in 1:1000) {
> > +   # x[y == 'a'] <- x[y == 'b']
> > +   x <- `[<-`(x, y == 'a', x[y == 'b'])
> > +   cat(i, '')
> > + }
> > 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
> > 29 30 31 32 33 34 35 36 37 ==4711== Invalid read of size 1
> > ==4711==    at 0x501A40F: Rf_xlength (Rinlinedfuns.h:542)
> > ==4711==    by 0x501A40F: VectorAssign (subassign.c:658)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > ==4711== Invalid read of size 8
> > ==4711==    at 0x501A856: XLENGTH_EX (Rinlinedfuns.h:189)
> > ==4711==    by 0x501A856: Rf_xlength (Rinlinedfuns.h:554)
> > ==4711==    by 0x501A856: VectorAssign (subassign.c:658)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3abb0 is 32 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > ==4711== Invalid read of size 1
> > ==4711==    at 0x501997E: SubassignTypeFix (subassign.c:318)
> > ==4711==    by 0x501A4A2: VectorAssign (subassign.c:666)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > ==4711== Invalid read of size 1
> > ==4711==    at 0x501A4B4: Rf_xlength (Rinlinedfuns.h:542)
> > ==4711==    by 0x501A4B4: VectorAssign (subassign.c:672)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > ==4711== Invalid read of size 8
> > ==4711==    at 0x501A573: XLENGTH_EX (Rinlinedfuns.h:189)
> > ==4711==    by 0x501A573: Rf_xlength (Rinlinedfuns.h:554)
> > ==4711==    by 0x501A573: VectorAssign (subassign.c:672)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3abb0 is 32 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > ==4711== Invalid read of size 1
> > ==4711==    at 0x501C582: INTEGER_ELT (Rinlinedfuns.h:381)
> > ==4711==    by 0x501C582: VectorAssign (subassign.c:710)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3ab90 is 0 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > ==4711== Invalid read of size 4
> > ==4711==    at 0x501C587: INTEGER_ELT (Rinlinedfuns.h:381)
> > ==4711==    by 0x501C587: VectorAssign (subassign.c:710)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Address 0x19b3abc0 is 48 bytes inside a block of size 160,048
> > free'd
> > ==4711==    at 0x4C2ACBD: free (vg_replace_malloc.c:530)
> > ==4711==    by 0x4FAFCB2: ReleaseLargeFreeVectors (memory.c:1055)
> > ==4711==    by 0x4FAFCB2: RunGenCollect (memory.c:1825)
> > ==4711==    by 0x4FAFCB2: R_gc_internal (memory.c:2998)
> > ==4711==    by 0x4FB166F: Rf_allocVector3 (memory.c:2682)
> > ==4711==    by 0x4FB2310: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x4FB2310: R_alloc (memory.c:2197)
> > ==4711==    by 0x5023F7A: logicalSubscript (subscript.c:575)
> > ==4711==    by 0x5026DA3: Rf_makeSubscript (subscript.c:994)
> > ==4711==    by 0x501A2F3: VectorAssign (subassign.c:656)
> > ==4711==    by 0x501CDFE: do_subassign_dflt (subassign.c:1641)
> > ==4711==    by 0x5020100: do_subassign (subassign.c:1571)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==  Block was alloc'd at
> > ==4711==    at 0x4C29BC3: malloc (vg_replace_malloc.c:299)
> > ==4711==    by 0x4FB1B04: Rf_allocVector3 (memory.c:2712)
> > ==4711==    by 0x5027574: Rf_allocVector (Rinlinedfuns.h:577)
> > ==4711==    by 0x5027574: Rf_ExtractSubset (subset.c:115)
> > ==4711==    by 0x502ADCD: VectorSubset (subset.c:198)
> > ==4711==    by 0x502ADCD: do_subset_dflt (subset.c:823)
> > ==4711==    by 0x502BE90: do_subset (subset.c:661)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4F7BAC3: Rf_evalListKeepMissing (eval.c:2955)
> > ==4711==    by 0x50200CB: R_DispatchOrEvalSP (subassign.c:1535)
> > ==4711==    by 0x50200CB: do_subassign (subassign.c:1567)
> > ==4711==    by 0x4F66398: bcEval (eval.c:6795)
> > ==4711==    by 0x4F7D86D: R_compileAndExecute (eval.c:1407)
> > ==4711==    by 0x4F7DA70: do_for (eval.c:2185)
> > ==4711==    by 0x4F7741C: Rf_eval (eval.c:691)
> > ==4711==    by 0x4FA7181: Rf_ReplIteration (main.c:258)
> > ==4711==    by 0x4FA7570: R_ReplConsole (main.c:308)
> > ==4711==    by 0x4FA760E: run_Rmainloop (main.c:1082)
> > ==4711==    by 0x40075A: main (Rmain.c:29)
> > ==4711==
> > 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
> > ...
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com
> >
> >
> > On Wed, Feb 27, 2019 at 12:31 AM Gabriel Becker <[hidden email]>
> > wrote:
> >
> > > Hi Brian,
> > >
> > > I don't have a windows machine, but on a modern macbook pro I'm not able to
> > > get this to crash in 3.5.1 or a very recent built-from-source R-devel.  I
> > > increased the length of x by 2 orders of magnitude but that just made the
> > > loop take a lot longer to successfully run in both R versions i tested.
> > >
> > > So seems like there is some OS/machine dependency at work here (?).
> > >
> > > Best,
> > > ~G
> > >
> > > On Wed, Feb 27, 2019 at 12:01 AM Brian Montgomery via R-devel <
> > > [hidden email]> wrote:
> > >
> > > > The following code crashes after about 300 iterations on
> > > > my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.
> > > > Others have duplicated this (see
> > > > https://github.com/tidyverse/magrittr/issues/190 if necessary), but I
> > > > don't know how machine/OS-dependent it may be.
> > > > If it doesn't crash for you, please try increasing the length of the x
> > > > vector.
> > > >
> > > > Substituting the commented-out line for the one below it works correctly
> > > > (prints out 1:1000 and ends normally) every time.
> > > >
> > > > x <- 1:200000
> > > > y <- rep(letters[1:5], length(x) / 5L)
> > > > for (i in 1:1000) {
> > > >   # x[y == 'a'] <- x[y == 'b']
> > > >   x <- `[<-`(x, y == 'a', x[y == 'b'])
> > > >   cat(i, '')
> > > > }
> > > > cat('\n')
> > > >
> > > > The point of using this syntax is to make it work better with pipes, but
> > > > the errors occur without pipes or magrittr.
> > > >
> > > > Thank you for your help!
> > > >
> > > > ______________________________________________
> > > > [hidden email] mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-devel
> > > >
> > >
> > >         [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-devel
> > >
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Tierney, Luke
In reply to this post by R devel mailing list
Thanks for the report. Should be fixed shortly.

Best,

luke

On Tue, 26 Feb 2019, Brian Montgomery via R-devel wrote:

> The following code crashes after about 300 iterations on my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.  
> Others have duplicated this (see https://github.com/tidyverse/magrittr/issues/190 if necessary), but I don't know how machine/OS-dependent it may be.  
> If it doesn't crash for you, please try increasing the length of the x vector.
>
> Substituting the commented-out line for the one below it works correctly (prints out 1:1000 and ends normally) every time.
>
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
>   # x[y == 'a'] <- x[y == 'b']
>   x <- `[<-`(x, y == 'a', x[y == 'b'])
>   cat(i, '')
> }
> cat('\n')
>
> The point of using this syntax is to make it work better with pipes, but the errors occur without pipes or magrittr.
>
> Thank you for your help!
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Tierney, Luke
In reply to this post by R devel mailing list
On Tue, 26 Feb 2019, Brian Montgomery via R-devel wrote:

> The following code crashes after about 300 iterations on my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.  
> Others have duplicated this (see https://github.com/tidyverse/magrittr/issues/190 if necessary), but I don't know how machine/OS-dependent it may be.  
> If it doesn't crash for you, please try increasing the length of the x vector.
>
> Substituting the commented-out line for the one below it works correctly (prints out 1:1000 and ends normally) every time.
>
> x <- 1:200000
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
>   # x[y == 'a'] <- x[y == 'b']
>   x <- `[<-`(x, y == 'a', x[y == 'b'])
>   cat(i, '')
> }
> cat('\n')
>
> The point of using this syntax is to make it work better with pipes, but the errors occur without pipes or magrittr.

Calling replacement functions this way is a Really Bad Idea. Some
assume they are being called properly and will end up mutating data
they should not when called this way.

Best,

luke

>
> Thank you for your help!
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Intermittent crashes with inset `[<-` command

Tierney, Luke
In reply to this post by Tierney, Luke
Fixed in R-devel and R-patched.

Best,

luke

On Wed, 27 Feb 2019, Tierney, Luke wrote:

> Thanks for the report. Should be fixed shortly.
>
> Best,
>
> luke
>
> On Tue, 26 Feb 2019, Brian Montgomery via R-devel wrote:
>
>> The following code crashes after about 300 iterations on my x86_64-w64-mingw32 machine on R 3.5.2 --vanilla.  
>> Others have duplicated this (see https://github.com/tidyverse/magrittr/issues/190 if necessary), but I don't know how machine/OS-dependent it may be.  
>> If it doesn't crash for you, please try increasing the length of the x vector.
>>
>> Substituting the commented-out line for the one below it works correctly (prints out 1:1000 and ends normally) every time.
>>
>> x <- 1:200000
>> y <- rep(letters[1:5], length(x) / 5L)
>> for (i in 1:1000) {
>>   # x[y == 'a'] <- x[y == 'b']
>>   x <- `[<-`(x, y == 'a', x[y == 'b'])
>>   cat(i, '')
>> }
>> cat('\n')
>>
>> The point of using this syntax is to make it work better with pipes, but the errors occur without pipes or magrittr.
>>
>> Thank you for your help!
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>

--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel