Skip to content

segfault when running runCaSpER() #89

Description

@dtenenba

Hi,

On a linux machine with 36 cores and 683 GB of RAM, I am opening a large CaSpER object:

> object.size(object)
2584761688 bytes
> object
An object of class casper in project casperProject
 18931 genes across 844 samples.

and then running runCaSpER() on it:

final.Objects <- CaSpER::runCaSpER(
  object,
  removeCentromere = TRUE,
  cytoband  = object@cytoband,
  method  = "fixed"
)

I immediately get a segfault:

 *** caught segfault ***
address 0x30, cause 'memory not mapped'

Traceback:
 1: aperm(output$xi, c(3, 2, 1))
 2: is.data.frame(x)
 3: colSums(aperm(output$xi, c(3, 2, 1)))
 4: t(colSums(aperm(output$xi, c(3, 2, 1))))
 5: manualSegment(correctOut$copy, chr, autosomes, param, maxiter,     verbose)
 6: HMMsegment(correctOut = rdata, param = object@hmmparam, verbose = F)
 7: PerformSegmentationWithHMM(object, cnv.scale = object@cnv.scale,     removeCentromere = T, cytoband = cytoband)
 8: CaSpER::runCaSpER(object, removeCentromere = TRUE, cytoband = object@cytoband,     method = "fixed")
 9: eval(ei, envir)
10: eval(ei, envir)
11: withVisible(eval(ei, envir))
12: source("script.R", echo = TRUE, max = Inf)

Here is the sessionInfo() with CaSpER loaded:

> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS;  LAPACK version 3.11.0

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

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

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

other attached packages:
 [1] CaSpER_0.2.0         GenomicRanges_1.56.0 GenomeInfoDb_1.40.0
 [4] GOstats_2.70.0       graph_1.82.0         Category_2.70.0
 [7] Matrix_1.7-4         org.Hs.eg.db_3.19.1  GO.db_3.19.1
[10] AnnotationDbi_1.66.0 Biobase_2.64.0       limma_3.60.0
[13] biomaRt_2.60.0       ape_5.8              ggnetwork_0.5.13
[16] intergraph_2.0-4     igraph_2.0.3         gridExtra_2.3
[19] scales_1.4.0         ggpubr_0.6.0         mclust_6.1.1
[22] reshape_0.8.9        ggplot2_4.0.2        IRanges_2.38.0
[25] S4Vectors_0.42.0     BiocGenerics_0.50.0  RColorBrewer_1.1-3
[28] pheatmap_1.0.12      signal_1.8-1         Rcpp_1.0.12

loaded via a namespace (and not attached):
 [1] bitops_1.0-7            DBI_1.2.2               RBGL_1.80.0
 [4] httr2_1.2.1             GSEABase_1.66.0         rlang_1.1.6
 [7] magrittr_2.0.4          matrixStats_1.3.0       compiler_4.4.0
[10] RSQLite_2.3.6           png_0.1-8               vctrs_0.6.5
[13] stringr_1.5.1           pkgconfig_2.0.3         crayon_1.5.2
[16] fastmap_1.2.0           backports_1.4.1         dbplyr_2.5.0
[19] XVector_0.44.0          utf8_1.2.4              UCSC.utils_1.0.0
[22] network_1.18.2          purrr_1.0.2             bit_4.0.5
[25] zlibbioc_1.50.0         cachem_1.0.8            jsonlite_1.8.8
[28] progress_1.2.3          blob_1.2.4              broom_1.0.5
[31] parallel_4.4.0          prettyunits_1.2.0       R6_2.6.1
[34] stringi_1.8.4           genefilter_1.86.0       car_3.1-2
[37] splines_4.4.0           tidyselect_1.2.1        dichromat_2.0-0.1
[40] abind_1.4-5             curl_7.0.0              lattice_0.22-6
[43] tibble_3.2.1            plyr_1.8.9              withr_3.0.2
[46] KEGGREST_1.44.0         S7_0.2.1                coda_0.19-4.1
[49] AnnotationForge_1.46.0  survival_3.6-4          BiocFileCache_2.12.0
[52] xml2_1.3.6              Biostrings_2.72.0       pillar_1.9.0
[55] filelock_1.0.3          MatrixGenerics_1.16.0   carData_3.0-5
[58] generics_0.1.3          RCurl_1.98-1.14         hms_1.1.3
[61] xtable_1.8-4            glue_1.8.0              tools_4.4.0
[64] annotate_1.82.0         ggsignif_0.6.4          XML_3.99-0.16.1
[67] tidyr_1.3.1             colorspace_2.1-0        nlme_3.1-164
[70] GenomeInfoDbData_1.2.12 cli_3.6.5               rappdirs_0.3.3
[73] fansi_1.0.6             dplyr_1.1.4             Rgraphviz_2.48.0
[76] gtable_0.3.6            rstatix_0.7.2           digest_0.6.35
[79] farver_2.1.2            memoise_2.0.1           lifecycle_1.0.4
[82] httr_1.4.7              statnet.common_4.9.0    statmod_1.5.0
[85] bit64_4.0.5             MASS_7.3-60.2

Interestingly, if I run a newer version of R and Linux on a machine with the same specs (and the same version of CaSpER), I still get a segfault, but in a different place:

 *** caught segfault ***
address 0x1, cause 'memory not mapped'

Traceback:
 1: manualSegment(correctOut$copy, chr, autosomes, param, maxiter,     verbose)
 2: HMMsegment(correctOut = rdata, param = object@hmmparam, verbose = F)
 3: PerformSegmentationWithHMM(object, cnv.scale = object@cnv.scale,     removeCentromere = T, cytoband = cytoband)
 4: CaSpER::runCaSpER(object, removeCentromere = TRUE, cytoband = object@cytoband,     method = "fixed")
 5: eval(ei, envir)
 6: eval(ei, envir)
 7: withVisible(eval(ei, envir))
 8: source("script.R", echo = TRUE, max = Inf)

The sessionInfo() on that machine is:

> sessionInfo()
R version 4.6.0 (2026-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.4 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=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
 [1] CaSpER_0.2.0         GenomicRanges_1.64.0 Seqinfo_1.2.0
 [4] GOstats_2.78.0       graph_1.90.0         Category_2.78.0
 [7] Matrix_1.7-5         org.Hs.eg.db_3.23.1  GO.db_3.23.1
[10] AnnotationDbi_1.74.0 Biobase_2.72.0       limma_3.68.3
[13] biomaRt_2.68.0       ape_5.8-1            ggnetwork_0.5.14
[16] intergraph_2.0-4     igraph_2.3.2         gridExtra_2.3
[19] scales_1.4.0         ggpubr_0.6.3         mclust_6.1.2
[22] reshape_0.8.10       ggplot2_4.0.3        IRanges_2.46.0
[25] S4Vectors_0.50.1     BiocGenerics_0.58.1  generics_0.1.4
[28] RColorBrewer_1.1-3   pheatmap_1.0.13      signal_1.8-1
[31] Rcpp_1.1.1-1.1

loaded via a namespace (and not attached):
 [1] DBI_1.3.0              bitops_1.0-9           RBGL_1.88.0
 [4] httr2_1.2.2            GSEABase_1.74.0        rlang_1.2.0
 [7] magrittr_2.0.5         matrixStats_1.5.0      compiler_4.6.0
[10] RSQLite_3.53.1         png_0.1-9              vctrs_0.7.3
[13] stringr_1.6.0          pkgconfig_2.0.3        crayon_1.5.3
[16] fastmap_1.2.0          backports_1.5.1        dbplyr_2.5.2
[19] XVector_0.52.0         network_1.20.0         purrr_1.2.2
[22] bit_4.6.0              cachem_1.1.0           progress_1.2.3
[25] blob_1.3.0             broom_1.0.13           parallel_4.6.0
[28] prettyunits_1.2.0      R6_2.6.1               stringi_1.8.7
[31] genefilter_1.94.0      car_3.1-5              splines_4.6.0
[34] tidyselect_1.2.1       abind_1.4-8            curl_7.1.0
[37] lattice_0.22-9         tibble_3.3.1           plyr_1.8.9
[40] withr_3.0.2            KEGGREST_1.52.0        S7_0.2.2
[43] coda_0.19-4.1          AnnotationForge_1.54.0 survival_3.8-6
[46] BiocFileCache_3.2.0    Biostrings_2.80.1      pillar_1.11.1
[49] filelock_1.0.3         MatrixGenerics_1.24.0  carData_3.0-6
[52] RCurl_1.98-1.18        hms_1.1.4              xtable_1.8-8
[55] glue_1.8.1             tools_4.6.0            annotate_1.90.0
[58] ggsignif_0.6.4         XML_3.99-0.23          tidyr_1.3.2
[61] nlme_3.1-169           Formula_1.2-5          cli_3.6.6
[64] rappdirs_0.3.4         dplyr_1.2.1            Rgraphviz_2.56.0
[67] gtable_0.3.6           rstatix_0.7.3          digest_0.6.39
[70] sna_2.8                farver_2.1.2           memoise_2.0.1
[73] lifecycle_1.0.5        httr_1.4.8             statnet.common_4.13.0
[76] statmod_1.5.2          bit64_4.8.2            MASS_7.3-65

I do notice that if I use method = "iterative" I don't get a crash immediately, instead I see some output and things seem to be working, but then after a few minutes I get another segfault, again in two different places depending on R/Linux version:

with the older Linux/R:

> out <- runCaSpER(object)
Performing recursive median filtering...
Performing HMM segmentation...

 *** caught segfault ***
address 0x30, cause 'memory not mapped'

Traceback:
 1: aperm(output$xi, c(3, 2, 1))
 2: is.data.frame(x)
 3: colSums(aperm(output$xi, c(3, 2, 1)))
 4: t(colSums(aperm(output$xi, c(3, 2, 1))))
 5: manualSegment(correctOut$copy, chr, autosomes, param, maxiter,     verbose)
 6: HMMsegment(correctOut = rdata, param = object@hmmparam, verbose = F)
 7: PerformSegmentationWithHMM(object, cnv.scale = i, removeCentromere = T,     cytoband = cytoband)
 8: runCaSpER(object)

with the newer Linux/R:

> final.Objects <- runCaSpER(object)
Performing recursive median filtering...
Performing HMM segmentation...

 *** caught segfault ***
address 0x1, cause 'memory not mapped'

Traceback:
 1: manualSegment(correctOut$copy, chr, autosomes, param, maxiter,     verbose)
 2: HMMsegment(correctOut = rdata, param = object@hmmparam, verbose = F)
 3: PerformSegmentationWithHMM(object, cnv.scale = i, removeCentromere = T,     cytoband = cytoband)
 4: runCaSpER(object)
 5: eval(ei, envir)
 6: eval(ei, envir)
 7: withVisible(eval(ei, envir))
 8: source("script.R", echo = TRUE, max = Inf)

Do you have any suggestions?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions