futureverse / futureverse/future

Globalenv variables are not picked up by future::getGlobalsAndPackages

Open
#548 4 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
R
Stars
1k
Forks
92
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

I found variables in the globalenv are not correctly picked up. Not sure if this is on purpose

**Reproduce example**

```r
env <- new.env()
d <- 1
env$a <- function(b){
b + d
}
future::plan("multisession")
f <- future::future({
env$a(1)
})
future::value(f)
#> Error in env$a(1) : object 'd' not found
```

**Expected behavior**

Variable `d` is not picked up by `future::getGlobalsAndPackages`, otherwise the result should be `2`

**Session information**
Please share your session information *after* the error has occurred so that we also see which packages and versions are involved, e.g.

```r
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.5.2

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.1.1 parallelly_1.28.1 parallel_4.1.1 tools_4.1.1
[5] listenv_0.8.0 codetools_0.2-18 digest_0.6.27 globals_0.14.0
[9] future_1.22.1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.