Temporary File Clash Possible when running in Parallel
stefanavey opened this issue · comments
From the documentation of base::tempfile
:
R processes forked by functions such as 'mclapply' in package
'parallel' (or 'multicore') share a per-session temporary
directory. Further, the 'guaranteed not to be currently in use'
applies only at the time of asking, and two children could ask
simultaneously. This is circumvented by ensuring that 'tempfile'
calls in different children try different names.
Therefore, the only way I know to make this package safe for parallel users is to supply an additional string to the tempfile call that will be unique in different children processes.
I've implemented this by adding a new function parameter unique.string
(see pull request #2). In this way, a call to CallCVX can pass in an extra string that is unique to each child to prevent a child from reading / writing / deleting temporary files from other children.
Hi Stefan,
I assume you'll be reissuing this as a pull request? The proposed change
sounds good.
Best,
Jacob
On Thu, Oct 8, 2015 at 2:00 PM, stefanavey notifications@github.com wrote:
—
Reply to this email directly or view it on GitHub
#3 (comment).
Jacob,
I assumed I needed to submit a new pull request but the changes were on the same branch as pull request #2 so you actually already pulled them into your repository by merging that one. I updated the wording of pull request #2 to reflect this. Probably would have been better for me to make a new branch and submit a new pull request but the changes were pulled in all together.
Peace,
Stefan
Oh I see that now! I'm new to github hence the confusion.
On Thu, Oct 8, 2015 at 2:13 PM, stefanavey notifications@github.com wrote:
Jacob,
I assumed I needed to submit a new pull request but the changes were on
the same branch as pull request #2
#2 so you actually already
pulled them into your repository by merging that one. I updated the wording
of pull request #2 #2 to
reflect this. Probably would have been better for me to make a new branch
and submit a new pull request but the changes were pulled in all together.Peace,
Stefan—
Reply to this email directly or view it on GitHub
#3 (comment).
Me too, no worries!