[Rcpp-devel] Rcpp_precious_remove again (Windows)

Dominick Samperi djsamperi at gmail.com
Sat Jan 28 17:42:25 CET 2023


I found a work-around that seems to fix the problems with RInside::repl()
and
I will submit the PR provided Tomas doesn't see any problems with this. The
work-around is to use code that is currently ifdef-ed out in
front-ends/rtest.c (a file that Tomas has worked on).

The REPL that is currently implemented using R_ReplDLLinit()
and R_ReplDLLdo1() is implemented instead by calling run_Rmainloop().

There is a comment in main.c noting that R_ReplDLLdo1()
can get out of sync, so it is not suitable for use as part
of the API.

Dominick

On Thu, Jan 26, 2023 at 2:26 PM Dominick Samperi <djsamperi at gmail.com>
wrote:

> Update: I seem to have many of the issues resolved, under R 4.2.2 and
> R-devel, except for a
> problem that shows up occasionally: RInside::repl() loop terminates
> immediately after
> a plot, for example, plot(0,0). I upgraded to Rcpp 1.0.10, but this didn't
> make any difference.
>
> Many of the problems I reported appear to have been caused by an
> anti-virus program
> (AVG) that silently deletes files that it thinks are "suspicious" like
> Rterm.exe. When it
> does this, Windows will not permit the file to be restored to its original
> location unless
> you reboot: you get an "access denied" message for a file that doesn't
> exit!
>
> The work-around is to tell AVG to treat certain directories (like the one
> containing
> Rterm.exe) as exceptions. I have seen no phantom instances  of processes
> since I made this change, so this may have fixed that problem as well (only
> time will tell).
>
> Dominick
>
>
>
>
>
>
>
>
>
>
>
>
>
> except that RInline::repl() often terminates
> immediately after a plot(0,0) command. This happens about 10% of the time.
>
>
>
> On Wed, Jan 25, 2023 at 9:14 AM Dominick Samperi <djsamperi at gmail.com>
> wrote:
>
>> Just today I simply started R in a CMD window (no Rcpp/RInside), and a
>> new window popped up
>> with the R prompt, instead of just starting the session in the current
>> window. This new window
>> goes away after a few seconds and you are left in the original window
>> with an R command prompt.
>>
>> I'm using the development version of R, and this has nothing to do with
>> Rcpp/RInside.
>>
>> This tends to happen rarely, usually the first time I run R after opening
>> the CMD window. Terminating
>> and running R again does not reproduce the problem, so it is somehow
>> dependent on
>> operating system context.
>>
>> Not sure if this is a bug or a side-effect of a virus infection.
>>
>> Dominick
>>
>>
>>
>>
>>
>>
>> On Mon, Jan 23, 2023 at 8:38 PM Dominick Samperi <djsamperi at gmail.com>
>> wrote:
>>
>>> The problems I have reported have three possible causes, individually, or
>>> in combination. Feedback from experts on this might help.
>>>
>>> 1. Changes to R internals esp. since R 4.2.0 may break RInline,
>>>      and also break other FFI apps that I'm working on (Haskell). For
>>>      example, fetching the address of the SEXP R_NilValue gives an
>>>      invalid address with R 4.2.2, but does not have this problem
>>>      with R 4.1.3, for example.
>>>
>>> 2. When you start a Windows CMD terminal, at least two threads
>>>     are started (can be seen in task manager), and sometimes Windows
>>>     seems to start two instances of your app instead of one. This may
>>>     be a bug in RInside, or a bug in Windows? Google shows that
>>>     others have reported problems caused by Windows starting two
>>>     terminals when you expect one.
>>>
>>> 3. There may be problems with the Rinline::repl() code that I have
>>>      not found yet.
>>>
>>> Dominick
>>>
>>>
>>>
>>>
>>> On Mon, Jan 23, 2023 at 1:43 PM Dirk Eddelbuettel <edd at debian.org>
>>> wrote:
>>>
>>>>
>>>> Maintainer of affected package here:
>>>>
>>>> On 23 January 2023 at 12:20, Dominick Samperi wrote:
>>>> | On the changes for R 4.2.0, it is not clear how to distinguish
>>>> | R API functions from R internal functions (and this probably
>>>> | doesn't matter for Rcpp), but you are correct,
>>>> | on closer inspection these changes should not have effected
>>>> | the way R_DefParams() was used before R_DefParamsEx()
>>>> | was introduced.
>>>> |
>>>> | It would be helpful if others could test to see if they can reproduce
>>>> | the problems I reported. I will submit a pull request when
>>>> | ready,
>>>>
>>>> That would be really appreciated! It really sounds like we could do
>>>> with an
>>>> update of some internals, and as seem to have spent some time in that
>>>> corner
>>>> you are likely right now the most qualified person to do this.
>>>>
>>>> | and if there is no objection, ifdefs will be included that
>>>> | permit compiling Rcpp and RInside using MSVC (there are only
>>>> | a few small changes with most of them applying to RInside.cpp).
>>>>
>>>> I think that is out of scope, and should be not in the pull request, and
>>>> RInside repo.
>>>>
>>>> By all means keep them in a branch / fork of yours if that is how you
>>>> work,
>>>> but the RInside package is part of R ecosystem which has a
>>>> well-established
>>>> empty intersection with the MSVC world and toolchains.
>>>>
>>>> Dirk
>>>>
>>>> --
>>>> dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20230128/15ab0cf1/attachment.html>


More information about the Rcpp-devel mailing list