Skip to content

parallel::clusterEvalQ(cl, Sys.sleep(1.0)) stalls on WSL2 #826

@mhahsler

Description

@mhahsler

This is quite exciting and might also be useful for my seriation package. I have tried some simple futurize examples on WSL2. Here is an example:

library(futurize)
plan(multisession) 

slow_fcn <- function(x) {
     Sys.sleep(0.1)  # emulate work
     x^2
}

xs <- 1:1000
ys <- lapply(xs, slow_fcn) |> futurize()

It first spawns some R-session instances, but then hangs and does not finish the job. It falls back to a single process with little CPU utilization, but does not finish. After esc/CTRL-C I get:

Warning: Caught FutureInterruptError. Canceling all iterations ...
Error: future_lapply() interrupted at 2026-03-01T10:36:49, while running on ‘25-11427’ (pid 195644)

doparallel works on WSL2. Any ideas.

Version used:

wsl --version
WSL version: 2.6.3.0
Kernel version: 6.6.87.2-1
WSLg version: 1.0.71
MSRDC version: 1.2.6353
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22631.6649
> sessionInfo()
R version 4.5.2 (2025-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

time zone: America/Chicago
tzcode source: system (glibc)

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

other attached packages:
[1] futurize_0.1.0 future_1.68.0  TSP_1.2.6     

loaded via a namespace (and not attached):
 [1] digest_0.6.39     codetools_0.2-20  doParallel_1.0.17 iterators_1.0.14  parallel_4.5.2    cli_3.6.5         foreach_1.5.2     parallelly_1.46.0
 [9] pkgload_1.4.1     compiler_4.5.2    globals_0.18.0    rstudioapi_0.17.1 tools_4.5.2       listenv_0.10.0    rlang_1.1.6      

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions