RGLab / CytoML

A GatingML Interface for Cross Platform Cytometry Data Sharing
GNU Affero General Public License v3.0
30 stars 14 forks source link

R Session Aborts when calling flowjo_to_gatingset() more than once #144

Open stephenchristy opened 2 years ago

stephenchristy commented 2 years ago

Hi there - I am running flowjo_to_gatingset() in an sapply function to generate different gating sets for different groups from FlowJo as in the code below:

gs_list <- sapply(groups, function(group) {
   CytoML::flowjo_to_gatingset(ws, name = group)
})

It will work fine if I only have one group and flowjo_to_gatingset() is only called once. But if I have more than one group, and flowjo_to_gatingset() is called more than once, my R session aborts. This only happens with R 4.2, I have run the same code for the last several years in R 4.0 and 4.1 and it works without issue. But I'd like to be able to call the function more than once in an R 4.2 session.

When I look at the Windows 10 Event Viewer Application Error, I can see the reason for the aborted R session:

Faulting application name: rsession-utf8.exe, version: 2022.7.1.0, time stamp: 0x62db30bc Faulting module name: tbb.dll, version: 0.0.0.0, time stamp: 0x62eb12ad Exception code: 0xc0000005 Fault offset: 0x0000000000010045 Faulting process id: 0x2ca0 Faulting application start time: 0x01d8b66af2ac2b9c Faulting application path: C:\Program Files\RStudio\bin\rsession-utf8.exe Faulting module path: C:\Users\user\AppData\Local\R\win-library\4.2\RcppParallel\lib\x64\tbb.dll Report Id: fdbaa282-e6ef-4d2b-848a-ae4d17442e23 Faulting package full name: Faulting package-relative application ID:

It seems like there might be an issue with RcppParallel or tbb.dll.

My session info is below:

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

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

loaded via a namespace (and not attached):
 [1] Biobase_2.57.1      httr_1.4.4          tidyr_1.2.0         jsonlite_1.8.0      carData_3.0-5       RcppParallel_5.1.5  stats4_4.2.1        latticeExtra_0.6-30
 [9] RBGL_1.73.0         flowWorkspace_4.9.1 yaml_2.3.5          pillar_1.8.1        backports_1.4.1     lattice_0.20-45     glue_1.6.2          digest_0.6.29      
[17] RColorBrewer_1.1-3  ggsignif_0.6.3      colorspace_2.0-3    ggcyto_1.25.1       plyr_1.8.7          XML_3.99-0.10       pkgconfig_2.0.3     broom_1.0.0        
[25] zlibbioc_1.43.0     purrr_0.3.4         flowCore_2.9.1      scales_1.2.1        jpeg_0.1-9          tzdb_0.3.0          tibble_3.1.8        aws.s3_0.3.21      
[33] assertr_2.8         generics_0.1.3      car_3.1-0           ggplot2_3.3.6       ellipsis_0.3.2      ggpubr_0.4.0        BiocGenerics_0.43.1 hexbin_1.28.2      
[41] cli_3.3.0           magrittr_2.0.3      deldir_1.0-6        evaluate_0.16       fansi_1.0.3         rstatix_0.7.0       xml2_1.3.3          graph_1.75.0       
[49] tools_4.2.1         data.table_1.14.2   ncdfFlow_2.43.1     hms_1.1.2           lifecycle_1.0.1     matrixStats_0.62.0  stringr_1.4.1       interp_1.1-3       
[57] S4Vectors_0.35.1    munsell_0.5.0       humarrow_0.0.0.9000 compiler_4.2.1      rlang_1.0.4         grid_4.2.1          rstudioapi_0.13     aws.signature_0.6.0
[65] base64enc_0.1-3     cytolib_2.9.1       gtable_0.3.0        abind_1.4-5         curl_4.3.2          R6_2.5.1            RProtoBufLib_2.9.0  gridExtra_2.3      
[73] dplyr_1.0.9         utf8_1.2.2          CytoML_2.9.0        readr_2.1.2         Rgraphviz_2.41.1    stringi_1.7.8       Rcpp_1.0.9          vctrs_0.4.1        
[81] png_0.1-7           tidyselect_1.1.2   

Thanks in advance!

schwebels commented 2 years ago

Hi, I have the same issue. I am running R version 4.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

flowjo_to_gatingset() works fine with the first group in the workspace, eg '97420-1-02 BAL Cells' in the following ouptput:

Groups in Workspace Name Num.Samples 1 All Samples 38 2 97420-1-02 BAL Cells 6 3 97420-1-02 PBMCs 6 4 Compensation 14

But R completely aborts when trying to run: flowjo_to_gatingset(WS,name="97420-1-02 PBMCs", keywords = c( "$FIL", "TBNM", "$DATE"), additional.sampleID = TRUE)

I also tried this code on a linux cluster running 'R/4.2.1-foss-2022a' and 'R-bundle-Bioconductor/3.15-foss-2022a-R-4.2.1' and after running the first flowjo_to_gatingset instance, it returns:

PBMC.gs <- flowjo_to_gatingset(WS, name="97415-1-04 PBMCs", keywords=c("$FIL", "TBNM", "$DATE"),additional.sampleID=TRUE)

caught segfault address 0xfffffffffffffff7, cause 'memory not mapped'

Traceback: 1: (function (ws, group_id, subset, execute, path, cytoset, backend_dir, backend, includeGates, additional_keys, additional_sampleID, keywords, is_pheno_data_from_FCS, keyword_ignore_case, extend_val, extend_to, channel_ignore_case, leaf_bool, include_empty_tree, skip_faulty_gate, comps, transform, fcs_file_extension, greedy_match, fcs_parse_arg, num_threads = 1L) { .Call(_CytoML_parse_workspace, ws, group_id, subset, execute, path, cytoset, backend_dir, backend, includeGates, additional_keys, additional_sampleID, keywords, is_pheno_data_from_FCS, keyword_ignore_case, extend_val, extend_to, channel_ignore_case, leaf_bool, include_empty_tree, skip_faulty_gate, comps, transform, fcs_file_extension, greedy_match, fcs_parse_arg, num_threads)})(ws = <pointer: 0x10da1550>, group_id = 2, subset = list(), execute = TRUE, path = "", cytoset = <pointer: 0xdc92a70>, backend_dir = "/tmp/job.66346.hpc/Rtmp9cKpPF", backend = "h5", includeGates = TRUE, additional_keys = "$TOT", additional_sampleID = TRUE, keywords = c("$FIL", "TBNM", "$DATE"), is_pheno_data_from_FCS = FALSE, keyword_ignore_case = FALSE, extend_val = 0, extend_to = -4000, channel_ignore_case = FALSE, leaf_bool = TRUE, include_empty_tree = FALSE, skip_faulty_gate = FALSE, comps = list(), transform = TRUE, fcs_file_extension = ".fcs", greedy_match = FALSE, fcs_parse_arg = list(), num_threads = 1) 2: do.call(parse_workspace, args) 3: flowjo_to_gatingset(WS, name = "97415-1-04 PBMCs", keywords = c("$FIL", "TBNM", "$DATE"), additional.sampleID = TRUE)

Thanks for any help with this! Bonnie

hclnyrk commented 2 years ago

Hi, I appear to be seeing the same issue when running flowjo_to_gatingset() consecutively

gs <- flowjo_to_gatingset(ws, name = 3, path = dataDirFCS)

gs2 <- flowjo_to_gatingset(ws, name = 4, path = dataDirFCS)

Running the first call works perfectly, but the second throws the following error:

caught segfault address 0xfffffffffffffff7, cause 'memory not mapped' Traceback: 1: (function (ws, group_id, subset, execute, path, cytoset, backend_dir, backend, includeGates, additional_keys, additional_sampleID, keywords, is_pheno_data_from_FCS, keyword_ignore_case, extend_val, extend_to, channel_ignore_case, leaf_bool, include_empty_tree, skip_faulty_gate, comps, transform, fcs_file_extension, greedy_match, fcs_parse_arg, num_threads = 1L) { .Call(_CytoML_parse_workspace, ws, group_id, subset, execute, path, cytoset, backend_dir, backend, includeGates, additional_keys, additional_sampleID, keywords, is_pheno_data_from_FCS, keyword_ignore_case, extend_val, extend_to, channel_ignore_case, leaf_bool, include_empty_tree, skip_faulty_gate, comps, transform, fcs_file_extension, greedy_match, fcs_parse_arg, num_threads)})(ws = <pointer: 0x55a065164380>, group_id = 3, subset = list(), execute = TRUE, path = "/media/huw/DATA/220826_Microspheres_32-colours-V04/Unmixed", cytoset = <pointer: 0x55a05df03be0>, backend_dir = "/tmp/RtmpYq7oXF", backend = "h5", includeGates = TRUE, additional_keys = "$TOT", additional_sampleID = FALSE, keywords = character(0), is_pheno_data_from_FCS = FALSE, keyword_ignore_case = FALSE, extend_val = 0, extend_to = -4000, channel_ignore_case = FALSE, leaf_bool = TRUE, include_empty_tree = FALSE, skip_faulty_gate = FALSE, comps = list(), transform = TRUE, fcs_file_extension = ".fcs", greedy_match = FALSE, fcs_parse_arg = list(), num_threads = 1) 2: do.call(parse_workspace, args) 3: flowjo_to_gatingset(ws, name = 4, path = dataDirFCS)

Here is the output of sessionInfo()

R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.1 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3 LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3

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

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

other attached packages: [1] CytoML_2.6.0

loaded via a namespace (and not attached): [1] tidyselect_1.2.0 lattice_0.20-45 colorspace_2.0-3 vctrs_0.5.1 generics_0.1.3 stats4_4.1.2 yaml_2.3.6
[8] ncdfFlow_2.40.0 base64enc_0.1-3 RBGL_1.70.0 utf8_1.2.2 flowCore_2.6.0 XML_3.99-0.12 rlang_1.0.6
[15] hexbin_1.28.2 pillar_1.8.1 withr_2.5.0 glue_1.6.2 DBI_1.1.3 aws.s3_0.3.21 Rgraphviz_2.38.0
[22] BiocGenerics_0.40.0 RColorBrewer_1.1-3 plyr_1.8.8 matrixStats_0.63.0 jpeg_0.1-9 lifecycle_1.0.3 zlibbioc_1.40.0
[29] RProtoBufLib_2.6.0 munsell_0.5.0 gtable_0.3.1 cytolib_2.6.2 latticeExtra_0.6-30 Biobase_2.54.0 curl_4.3.3
[36] flowWorkspace_4.6.0 fansi_1.0.3 Rcpp_1.0.9 scales_1.2.1 S4Vectors_0.32.4 jsonlite_1.8.3 RcppParallel_5.1.5 [43] graph_1.72.0 deldir_1.0-6 interp_1.1-3 gridExtra_2.3 ggplot2_3.4.0 png_0.1-7 digest_0.6.30
[50] dplyr_1.0.10 grid_4.1.2 cli_3.4.1 tools_4.1.2 magrittr_2.0.3 tibble_3.1.8 aws.signature_0.6.0 [57] pkgconfig_2.0.3 data.table_1.14.6 xml2_1.3.3 assertthat_0.2.1 httr_1.4.4 rstudioapi_0.14 R6_2.5.1
[64] ggcyto_1.22.0 compiler_4.1.2

Your help getting to the bottom of this would be much appreacated!

H

nimayassini commented 1 year ago

I was running into the same issue. I had CytoML under version 2.8.1 I believe. After updating it to 2.10.0, the issue is now resolved for me.