Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

nested futures that doesn't terminate

Abierto
#348 9 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
r

Línea de trabajo

Comienza con el reproductor en R del issue, comparando el plan secuencial con el plan anidado de multiproceso/secuencial alrededor de furrr::future_map. Inspecciona cómo future y parallel gestionan el cierre de los procesos hijo, incluido el mensaje reportado „unable to terminate some child processes“. Se considera terminado cuando la reproducción tiene una causa documentada y una resolución verificada, o un informe upstream claramente delimitado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

cannot-parallelize-bc-non-exportable-object documentation

I am having issues with nested future calls.

Here I'm using mlr3 and furrr, both using future package. When using them both together I'm having issues to have the parallelized calls to terminate.

library(magrittr)
library(mlr3)
library(mlr3learners)
dtas_lst <-
  list(
    dta1 = iris %>% dplyr::select(-Species) %>% utils::head(75),
    dta2 = iris %>% dplyr::select(-Species) %>% utils::tail(75)
  )

run_xgb <- function(dta, target_column = "Sepal.Length") {
  ttsk <- mlr3::TaskRegr$new("ttsk", backend = dta, target = target_column)
  learner <-
    mlr3::lrn(
      "regr.xgboost",
      objective = "reg:linear",
      eval_metric = "rmse",
      nrounds = 100,
      verbose = 0
    )
  learner$train(ttsk)
  learner$predict(ttsk)$response
}
future::plan(list(future::sequential))
furrr::future_map(dtas_lst, run_xgb, .progress = TRUE) # works!
future::plan(list(future::multiprocess, future::sequential))
furrr::future_map(dtas_lst, run_xgb, .progress = TRUE) # doesn't terminate

I've had cases where the parallel runs do work once during a session, but then not terminating on a rerun.

Sometimes when closing down the session (after manually terminating the parallel run), I get the below message

# Error while shutting down parallel: unable to terminate some child processes

Upon googling this, I found that I could do the following check.

parallel::mcparallel(scan(n = 1, quiet = TRUE))
# $pid
# [1] 32763

# $fd
# [1] 21 24

# attr(,"class")
# [1] "parallelJob"  "childProcess" "process"

Does anyone have any solutions to this? Is this perhaps a bug? Related to future or perhaps parallel or other package? I was having the same issue when I was running the mlr package.

> Sys.info()
                                     sysname
                                     "Linux"
                                     release
                         "4.15.0-66-generic"
                                     version
"#75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019"
...
                                     machine
                                    "x86_64"
...
Lenguaje dominante
R
Estrellas
1k
Forks
93
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de futureverse/future

Todos los issues de futureverse/future

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.