Skip to content

Protect against using forked processes (aka "multicore") in RStudio #299

@HenrikBengtsson

Description

@HenrikBengtsson

Issue

Parallelization via forked processing should be avoided when running R from RStudio, cf.
rstudio/rstudio#2597 (comment). There are simply too many things that may break RStudio's interaction with R. Several RStudio users report on R sessions hanging and stray R processes that do not terminate. This is a problem that has been there from the beginning and it is a hard problem to solve so to the best of my knowledge it's unlikely that this will be "fixed" in RStudio any time soon.

In terms of the future ecosystem, this means that we should avoid using plan(multicore) when running R via RStudio.

Tasks

  • Make it possible to enable/disable forking when running RStudio:
    • environment variable R_FUTURE_FORK_ENABLE=true/false
    • R option future.fork.enable = TRUE/FALSE
    • Have supportsMulticore() acknowledge these. When unset, try to infer automatically, e.g. disable when running on MS Windows or via RStudio. This will cause multicore to fall back to sequential when running in RStudio similarly to how it works when on MS Windows.
  • Comment about this in the help/docs, e.g.
    • help(multicore)
    • supportsMulticore()

See also

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions