diff --git a/DESCRIPTION b/DESCRIPTION index 27e8c5fa..327bc55f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: brms Encoding: UTF-8 Type: Package Title: Bayesian Regression Models using 'Stan' -Version: 2.22.5 -Date: 2024-11-08 +Version: 2.22.6 +Date: 2024-11-14 Authors@R: c(person("Paul-Christian", "Bürkner", email = "paul.buerkner@gmail.com", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index eb5351b4..9edd5542 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,16 @@ * Fit extended-support Beta models via family `xbeta` thanks to Ioannis Kosmidis. (#1698) +### Bug Fixes + +* Avoid the creation of zombie workers when executing `log_lik` +in parallel thanks to Aki Vehtari and Noa Kallioinen. +For now, `log_lik` will use PSOCK clusters if run +in parallel even on Unix systems. To avoid potential speed loss for small +models, `log_lik` will not use `option(mc.cores)` anymore. +These changes may be reverted once the underlying causes of this +issue have been fixed. (#1658) + ### Other Changes * Improve sampling efficiency of `beta_binomial` models. (#1703) diff --git a/R/misc.R b/R/misc.R index 1d630265..29218762 100644 --- a/R/misc.R +++ b/R/misc.R @@ -435,11 +435,11 @@ plapply <- function(X, FUN, .cores = 1, .psock = TRUE, ...) { on.exit(parallel::stopCluster(cl)) out <- parallel::parLapply(cl = cl, X = X, fun = FUN, ...) } - # The version below hopefully prevents the spawning of zombies + # The version below was suggested to prevent the spawning of zombies # but it does not always succeed in that. It also seems to cause # other issues as discussed in #1658, so commented out for now. # cl_type <- ifelse(os_is_windows(), "PSOCK", "FORK") - # cl <- parallel::makeCluster(cores, type = cl_type) + # cl <- parallel::makeCluster(.cores, type = cl_type) # # Register a cleanup for the cluster in case the function fails # # Need to wrap in a tryCatch to avoid error if cluster is already stopped # on.exit(tryCatch(