From tomas.kalibera at gmail.com  Fri Nov 10 10:26:08 2017
From: tomas.kalibera at gmail.com (Tomas Kalibera)
Date: Fri, 10 Nov 2017 10:26:08 +0100
Subject: [Rd] check does not check that package examples remove tempdir()
In-Reply-To: <20171109015542.GA3076@tomyris>
References: <CAF8bMcZfc7uibFXC7Gx=qjXr4J808rKupZjf6AUhTBeV_Vu1ig@mail.gmail.com>
 <CAFDcVCQt=+gZf-=j_bv2Zt5aNoyhT8WWOjSrLPu9GF97CqFC8w@mail.gmail.com>
 <CAF8bMcYxiaLxig_gbgybficK7QcRYwu7N5A9ChrzK+Lr1Pw9cQ@mail.gmail.com>
 <20171109015542.GA3076@tomyris>
Message-ID: <a7e2d047-c983-8243-c5d4-a098422a4da1@gmail.com>


Please note there is parallel::mcparallel/mccollect in R which provides 
similar functionality, mcparallel starts a new job and mccollect allows 
to wait for it.

You are right about _exit, but there are additional issues which cannot 
be solved independently in an external package, and, such a low level 
interface cannot be used without race conditions from R anyway.

Best
Tomas

On 11/09/2017 02:55 AM, danlrobertson89 at gmail.com wrote:
>> tempdir(). I think it happens because the forked process shares the
>> value of tempdir() with the parent process and removes it when it
>> exits.
> This is very likely the case. Pretty much the entire library can be
> summed up by bfork_fork, which is the following.
>
>      SEXP res;
>      pid_t pid;
>      if((pid = fork()) == 0) {
>          PROTECT(res = eval(lang1(fn), R_GlobalEnv));
>          PROTECT(res = eval(lang2(install("q"), mkString("no")), R_GlobalEnv));
>          UNPROTECT(2);
>      }
>
>      return ScalarInteger(pid);
>
> I wrote this lib when I was still in school and can see several issues
> with the implementation of `bfork_fork`. This issue happens because
> we do not exit with _exit, but by essentially calling q("no").
>
> Cheers,
>
> Dan
>
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



	[[alternative HTML version deleted]]



[Rd] check does not check that package examples remove tempdir()
Tomas Kalibera