From winstonchang1 at gmail.com  Tue Apr  4 22:29:40 2017
From: winstonchang1 at gmail.com (Winston Chang)
Date: Tue, 4 Apr 2017 15:29:40 -0500
Subject: [Rd] Very hard to reproduce bug (?) in R-devel
In-Reply-To: <CAFOpNVG6RtN47SVvg_L1HKYSOPccnXgWjMX3ouLGxjCKXovc=Q@mail.gmail.com>
References: <CAFOpNVFQyz_UtDkuZFxa9ttCcQc6wvN7bDb5AbfsfTT_HuHeog@mail.gmail.com>
 <CAFOpNVG6RtN47SVvg_L1HKYSOPccnXgWjMX3ouLGxjCKXovc=Q@mail.gmail.com>
Message-ID: <CAFOpNVGO4DEVE+=0Ujysb+zPksyJGA8t1mkB9929wSndJTS0gA@mail.gmail.com>

>
>
>>
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 variable `x`, then removes that item from `p$e`. Then it invokes
`x()`. The loop runs again, until there are no more items in `p$e`.

The problem is that `ls(p$e)` sometimes returns the wrong values -- it
returns the values that it had in previous iterations of the loop. The
behavior is very touchy. Almost any change to the code will slightly change
the behavior; sometimes the `ls()` returns values from a different
iteration of the loop, and sometimes the problem doesn't happen at all.

I've put a  Dockerfile and instructions for reproducing the problem here:
  https://gist.github.com/wch/2596a1c9f1bcdee91bb210c782141c88

I think that I've gotten about as far with this as I can, though I'd be
happy to provide more information if anyone wants to take look at the
problem.

-Winston

	[[alternative HTML version deleted]]



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