shikokuchuo/mirai

"Warning: stack imbalance" when calling server() inside a function

wlandau opened this issue · 2 comments

After mirai 0.8.7.9025 (which I am almost certain fixes wlandau/crew#88) I started noticing instances of a stack imbalance warning when I call server() from inside another function (which happens in crew). Oddly, it only seems to happen on Linux machines (RHEL and Ubuntu), and it does not seem to interfere with task completion. Reprex:

library(mirai)
packageVersion("mirai")
#> [1] ‘0.8.7.9025’
mirai::daemons(
  n = 1L,
  url = "ws://127.0.0.1:0",
  dispatcher = TRUE,
  token = TRUE
)
#> [1] 1
task <- mirai::mirai(TRUE)
url <- rownames(daemons()$daemons)[1]
run_server <- function(url) {
  mirai::server(url = url, maxtasks = 1L, cleanup = 0L)
}
run_server(url)
#> Warning: stack imbalance in '{', 5 then 4
nanonext::msleep(100)
task$data
#> [1] TRUE

This was fixed by 2df4177. Just a spurious UNPROTECT that happened to be in the nanonext build.

Awesome, thanks!