Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-06 Thread Winston Chang
With Luke Tierney's assistance, we found that the root cause of the problem was not R, but a race condition in the pool package that occurred when a finalizer ran. Below is a very contrived and simplified example to illustrate: gc() n <- 1 increment_n <- function() { cat(n, "-", sep = "") #

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
> > Also my suspicion, can you try without having JIT enabled? > The results for different JIT levels. I ran compiler::enableJIT() before sourcing the test file: 3: error 2: error 1: OK 0: OK -Winston [[alternative HTML version deleted]] __ R-

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
> > Apologies in advance if this is just stating the obvious, but let me try > and put some general ideas on the table. These are great ideas, thanks. > - is anything non-deterministic involved? (Doesn't sound so, but...) > There was an environment where items were added, and the names of th

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Uwe Ligges
On 05.04.2017 23:54, peter dalgaard wrote: On 05 Apr 2017, at 20:40 , Winston Chang wrote: I think there's a good chance that this is due to a bug in R. I have been trying to track down the cause of the problem but haven't been able find it. -Winston Apologies in advance if this is just

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread peter dalgaard
> On 05 Apr 2017, at 20:40 , Winston Chang wrote: > > I think there's a good chance that this is due to a bug in R. I have > been trying to track down the cause of the problem but haven't been > able find it. > > -Winston Apologies in advance if this is just stating the obvious, but let me try

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
Hi Dirk, I sent another message just before yours, so you may not have seen it: === I just tried recompiling R with no -O flag, and I still get the same error. Here are the CFLAGS (the RD program runs R-devel instead of R 3.3.3): # RD CMD config CFLAGS -g -fdebug-prefix-map=/build/r-base

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Dirk Eddelbuettel
On 5 April 2017 at 15:46, Winston Chang wrote: | On Wed, Apr 5, 2017 at 2:24 PM, Robert McGehee | wrote: | | > Winston, | > I had a similar experience to you tracking down an insanely difficult bug | > in my R code that "disappeared" whenever slight changes were made to the | > script (e.g. like

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
ent: Wednesday, April 05, 2017 2:41 PM > To: Martin Maechler > Cc: R Development > Subject: Re: [Rd] Very hard to reproduce bug (?) in R-devel > > ) > > On Wed, Apr 5, 2017 at 2:59 AM, Martin Maechler > wrote: > > > > >>>>> Winston Chang > >

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
On Wed, Apr 5, 2017 at 2:24 PM, Robert McGehee wrote: > Winston, > I had a similar experience to you tracking down an insanely difficult bug > in my R code that "disappeared" whenever slight changes were made to the > script (e.g. like adding cat() statements). In my case, it coincided with > my

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Robert McGehee
-Original Message- From: R-devel [mailto:r-devel-boun...@r-project.org] On Behalf Of Winston Chang Sent: Wednesday, April 05, 2017 2:41 PM To: Martin Maechler Cc: R Development Subject: Re: [Rd] Very hard to reproduce bug (?) in R-devel ) On Wed, Apr 5, 2017 at 2:59 AM, Martin

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
) On Wed, Apr 5, 2017 at 2:59 AM, Martin Maechler wrote: > > > Winston Chang > > on Tue, 4 Apr 2017 15:29:40 -0500 writes: > > > I've done some more investigation into the problem, and it is very > > difficult to pin down. What it looks like is happening is roughly like > th

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Martin Maechler
> Winston Chang > on Tue, 4 Apr 2017 15:29:40 -0500 writes: > I've done some more investigation into the problem, and it is very > difficult to pin down. What it looks like is happening is roughly like this: > - `p` is an environment and `p$e` is also an environment.

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-04 Thread Winston Chang
> > >> I've done some more investigation into the problem, and it is very difficult to pin down. What it looks like is happening is roughly like this: - `p` is an environment and `p$e` is also an environment. - There is a loop. In each iteration, it looks for one item in `p$e`, saves it in a variab

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-03 Thread Winston Chang
Small correction to my previous email: the error can also be replicated by installing the package and then sourcing the tests. This is slightly faster than running R CMD check. It is also how we ran the tests with gdb. This will run the tests in a Docker container and raise the same error. (To run

[Rd] Very hard to reproduce bug (?) in R-devel

2017-04-03 Thread Winston Chang
When running R CMD check on a package, we are encountering an error on R-devel (as of 72457) on Linux. Unfortunately, it is very hard to reproduce, and almost any change to the code makes the error go away. I believe that this is due to a bug in R-devel, which has been present since at least commit