Skip to content

Error when launching multiprocess (CellChat) #808

@YuyanRuan

Description

@YuyanRuan

Describe the bug
When I run

cellchat <- computeCommunProb(cellchat, type = "truncatedMean", trim = 0.1, raw.use=T, 
                                distance.use = FALSE, interaction.range = 250, scale.distance = NULL,
                                contact.dependent = T, contact.range = 14,
                                population.size=T)

Warning: Caught FutureLaunchError. Canceling all iterations ...
Error: Caught an unexpected error of class FutureError when trying to launch future (‘future_sapply-9’) on backend of class MultisessionFutureBackend. The reason was: MultisessionFuture (‘future_sapply-9’) failed to launch future on cluster RichSOCKnode #9 (PID 42096 on localhost ‘localhost’). The reason reported was ‘error writing to connection’. Post-mortem diagnostic: No process exists with this PID, i.e. the localhost worker is no longer alive. The total size of the 11 globals exported is 27.14 GiB The three largest globals are ‘...future.FUN’ (11.18 GiB of class ‘function’), ‘FunMean’ (11.18 GiB of class ‘function’) and ‘data.use’ (4.58 GiB of class ‘numeric’)
In addition: Warning message:
In asMethod(object) :
sparse->dense coercion: allocating vector of size 4.6 GiB

It raises error when running into computeExpr_LR function. Here is the detailed function.

function (geneLR, data.use, complex_input) 
{
  nLR <- length(geneLR)
  numCluster <- ncol(data.use)
  index.singleL <- which(geneLR %in% rownames(data.use))
  dataL1avg <- data.use[geneLR[index.singleL], ]
  dataLavg <- matrix(nrow = nLR, ncol = numCluster)
  dataLavg[index.singleL, ] <- dataL1avg
  index.complexL <- setdiff(1:nLR, index.singleL)
  if (length(index.complexL) > 0) {
    complex <- geneLR[index.complexL]
    data.complex <- computeExpr_complex(complex_input, data.use, 
      complex)
    dataLavg[index.complexL, ] <- data.complex
  }
  return(dataLavg)
}

Session information

Please share your session information after the error has occurred so that we also see which packages and versions are involved;

> sessionInfo()
> sessionInfo()
R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=English_Hong Kong SAR.utf8  LC_CTYPE=English_Hong Kong SAR.utf8    LC_MONETARY=English_Hong Kong SAR.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_Hong Kong SAR.utf8    

time zone: Asia/Hong_Kong
tzcode source: internal

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

other attached packages:
 [1] Seurat_5.2.1        SeuratObject_5.1.0  sp_2.2-0            future_1.67.0-9003  patchwork_1.3.1     CellChat_2.2.0      Biobase_2.68.0     
 [8] BiocGenerics_0.54.0 generics_0.1.4      ggplot2_3.5.2       igraph_2.1.4        dplyr_1.1.4        

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3     rstudioapi_0.17.1      jsonlite_2.0.0         shape_1.4.6.1          magrittr_2.0.3         spatstat.utils_3.1-5  
  [7] farver_2.1.2           GlobalOptions_0.1.2    vctrs_0.6.5            ROCR_1.0-11            spatstat.explore_3.5-2 rstatix_0.7.2         
 [13] htmltools_0.5.8.1      BiocNeighbors_2.2.0    broom_1.0.9            Formula_1.2-5          sctransform_0.4.2      sass_0.4.10           
 [19] parallelly_1.45.1      KernSmooth_2.23-26     bslib_0.9.0            htmlwidgets_1.6.4      ica_1.0-3              plyr_1.8.9            
 [25] plotly_4.11.0          zoo_1.8-14             cachem_1.1.0           mime_0.13              lifecycle_1.0.4        ggnetwork_0.5.13      
 [31] iterators_1.0.14       pkgconfig_2.0.3        Matrix_1.7-3           R6_2.6.1               fastmap_1.2.0          fitdistrplus_1.2-4    
 [37] shiny_1.11.1           clue_0.3-66            digest_0.6.37          colorspace_2.1-1       S4Vectors_0.46.0       tensor_1.5.1          
 [43] RSpectra_0.16-2        irlba_2.3.5.1          textshaping_1.0.1      ggpubr_0.6.1           progressr_0.15.1       spatstat.sparse_3.1-0 
 [49] polyclip_1.10-7        httr_1.4.7             abind_1.4-8            compiler_4.5.1         rngtools_1.5.2         withr_3.0.2           
 [55] doParallel_1.0.17      backports_1.5.0        carData_3.0-5          fastDummies_1.7.5      ggsignif_0.6.4         MASS_7.3-65           
 [61] rjson_0.2.23           tools_4.5.1            lmtest_0.9-40          httpuv_1.6.16          future.apply_1.20.0    goftest_1.2-3         
 [67] glue_1.8.0             nlme_3.1-168           promises_1.3.3         grid_4.5.1             Rtsne_0.17             gridBase_0.4-7        
 [73] cluster_2.1.8.1        reshape2_1.4.4         spatstat.data_3.1-6    gtable_0.3.6           tidyr_1.3.1            sna_2.8               
 [79] data.table_1.17.8      car_3.1-3              spatstat.geom_3.5-0    RcppAnnoy_0.0.22       ggrepel_0.9.6          RANN_2.6.2            
 [85] foreach_1.5.2          pillar_1.11.0          stringr_1.5.1          spam_2.11-1            RcppHNSW_0.6.0         later_1.4.2           
 [91] circlize_0.4.16        splines_4.5.1          lattice_0.22-7         deldir_2.0-4           survival_3.8-3         FNN_1.1.4.1           
 [97] tidyselect_1.2.1       registry_0.5-1         ComplexHeatmap_2.24.1  miniUI_0.1.2           pbapply_1.7-4          gridExtra_2.3         
[103] IRanges_2.42.0         scattermore_1.2        svglite_2.2.1          stats4_4.5.1           NMF_0.28               matrixStats_1.5.0     
[109] stringi_1.8.7          statnet.common_4.12.0  lazyeval_0.2.2         codetools_0.2-20       tibble_3.3.0           BiocManager_1.30.26   
[115] cli_3.6.5              uwot_0.2.3             xtable_1.8-4           reticulate_1.43.0      systemfonts_1.2.3      jquerylib_0.1.4       
[121] network_1.19.0         Rcpp_1.1.0             spatstat.random_3.4-1  globals_0.18.0         coda_0.19-4.1          png_0.1-8             
[127] spatstat.univar_3.1-4  parallel_4.5.1         dotCall64_1.2          ggalluvial_0.12.5      listenv_0.9.1          viridisLite_0.4.2     
[133] scales_1.4.0           ggridges_0.5.6         purrr_1.1.0            crayon_1.5.3           GetoptLong_1.0.5       rlang_1.1.6           
[139] cowplot_1.2.0         

> future::futureSessionInfo()
*** Package versions
future 1.67.0.9003, parallelly 1.45.1, parallel 4.5.1, globals 0.18.0, listenv 0.9.1

*** Allocations
availableCores():
           system /proc/self/status 
               40                40 
availableWorkers():
$system
 [1] "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost"
[13] "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost"
[25] "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost" "localhost"
[37] "localhost" "localhost" "localhost" "localhost"


*** Settings
- future.plan=<not set>
- future.fork.multithreading.enable=<not set>
- future.globals.maxSize=137438953472
- future.globals.onReference=<not set>
- future.resolve.recursive=<not set>
- future.rng.onMisuse=<not set>
- future.wait.timeout=<not set>
- future.wait.interval=<not set>
- future.wait.alpha=<not set>
- future.startup.script=<not set>

*** Backends
Number of workers: 40
List of future strategies:
1. multisession:
   - args: function (..., workers = availableCores(constraints = "connections-16"), rscript_libs = .libPaths())
   - tweaked: FALSE
   - call: plan(multisession)

*** Basic tests
Worker R session details:
   worker    pid     r sysname release     version nodename machine   login    user effective_user udomain
1       1  92608 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
2       2  85784 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
3       3  57656 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
4       4 108876 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
5       5  87460 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
6       6 112216 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
7       7 110344 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
8       8 112104 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
9       9 111840 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
10     10 108764 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
11     11 108916 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
12     12 107656 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
13     13  98328 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
14     14 112108 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
15     15 100300 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
16     16 101808 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
17     17  77472 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
18     18 105540 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
19     19 111072 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
20     20 109224 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
21     21  36268 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
22     22 112520 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
23     23 102796 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
24     24 106432 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
25     25  90312 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
26     26 109124 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
27     27  19772 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
28     28  73008 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
29     29  75044 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
30     30 111752 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
31     31 108672 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
32     32 109668 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
33     33  75048 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
34     34 111860 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
35     35 108708 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
36     36 111036 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
37     37  91300 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
38     38 109060 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
39     39 104108 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
40     40 104876 4.5.1 Windows  10 x64 build 26100  host001  x86-64 user001 user001        user001   HKUST
Number of unique worker PIDs: 40 (as expected)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions