GenomicRanges: C stack usage … is too close to the limit

橙三吉。 提交于 2021-02-10 15:49:12

问题


I'm loading a built-in ideogram from the biovizBase package:

data("hg19Ideogram", package = "biovizBase")

The actual object is fine when inspected with str:

> hg19Ideogram %>% str
Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
  ..@ seqnames       :Formal class 'Rle' [package "IRanges"] with 4 slots
  .. .. ..@ values         : Factor w/ 93 levels "chr1","chr1_gl000191_random",..: 1 2 3 4 5 6 7 8 9 10 ...
  .. .. ..@ lengths        : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ ranges         :Formal class 'IRanges' [package "IRanges"] with 6 slots
  .. .. ..@ start          : int [1:93] 1 1 1 1 1 1 1 1 1 1 ...
  .. .. ..@ width          : int [1:93] 249250621 106433 547496 243199373 198022430 191154276 590426 189789 191469 180915260 ...
  .. .. ..@ NAMES          : NULL
  .. .. ..@ elementType    : chr "integer"
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ strand         :Formal class 'Rle' [package "IRanges"] with 4 slots
  .. .. ..@ values         : Factor w/ 3 levels "+","-","*": 3
  .. .. ..@ lengths        : int 93
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ elementMetadata:Formal class 'DataFrame' [package "IRanges"] with 6 slots
  .. .. ..@ rownames       : NULL
  .. .. ..@ nrows          : int 93
  .. .. ..@ listData       : Named list()
  .. .. ..@ elementType    : chr "ANY"
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ seqinfo        :Formal class 'Seqinfo' [package "GenomicRanges"] with 4 slots
  .. .. ..@ seqnames   : chr [1:93] "chr1" "chr1_gl000191_random" "chr1_gl000192_random" "chr2" ...
  .. .. ..@ seqlengths : int [1:93] 249250621 106433 547496 243199373 198022430 191154276 590426 189789 191469 180915260 ...
  .. .. ..@ is_circular: logi [1:93] NA NA NA NA NA NA ...
  .. .. ..@ genome     : chr [1:93] "hg19" "hg19" "hg19" "hg19" ...
  ..@ metadata       : list()

But printing it results in an error:

> hg19Ideogram
GRanges object with 93 ranges and 0 metadata columns:
Error: C stack usage  7969604 is too close to the limit

Printing any of the sub-objects results in no errors (including the IRanges), so it seems the error is with the print call to the GRanges in particular.

Furthermore, trying to use it with ggbio results in the same error:

> ggplot() +
+   layout_circle(hg19Ideogram)
Error: C stack usage  7969268 is too close to the limit

There are a number of other questions about this error:

  • Error: C stack usage is too close to the limit
  • Error: C stack usage 24324761 is too close to the limit
  • dendrapply Error: C stack usage is too close to the limit
  • Erorr: C stack usage is too close to the limit in R

none of which provided a solution that worked for me.

Cstack

> Cstack_info()
      size    current  direction eval_depth 
   7969177      16048          1          2 

Versions

One person suggested updating software to fix the problem. I updated to latest version of R, RStudio and ggbio (and related packages), but it did not change anything.

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

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

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

other attached packages:
 [1] GenomicRanges_1.28.4 GenomeInfoDb_1.12.2  IRanges_2.10.2       S4Vectors_0.14.3     biovizBase_1.24.0    ggbio_1.24.1        
 [7] BiocGenerics_0.22.0  dplyr_0.7.1          purrr_0.2.2.2        readr_1.1.1          tidyr_0.6.3          tibble_1.3.3        
[13] ggplot2_2.2.1        tidyverse_1.1.1      psych_1.7.5          pacman_0.4.6        

loaded via a namespace (and not attached):
  [1] colorspace_1.3-2              htmlTable_1.9                 XVector_0.16.0                base64enc_0.1-3              
  [5] dichromat_2.0-0               bit64_0.9-7                   interactiveDisplayBase_1.14.0 AnnotationDbi_1.38.1         
  [9] lubridate_1.6.0               xml2_1.1.1                    splines_3.4.1                 mnormt_1.5-5                 
 [13] knitr_1.16                    Formula_1.2-1                 jsonlite_1.5                  Rsamtools_1.28.0             
 [17] broom_0.4.2                   cluster_2.0.3                 graph_1.54.0                  shiny_1.0.3                  
 [21] compiler_3.4.1                httr_1.2.1                    backports_1.1.0               assertthat_0.2.0             
 [25] Matrix_1.2-3                  lazyeval_0.2.0                acepack_1.4.1                 htmltools_0.3.6              
 [29] tools_3.4.1                   bindrcpp_0.2                  gtable_0.2.0                  glue_1.1.1                   
 [33] GenomeInfoDbData_0.99.0       reshape2_1.4.2                Rcpp_0.12.11                  Biobase_2.36.2               
 [37] cellranger_1.1.0              Biostrings_2.44.1             nlme_3.1-124                  rtracklayer_1.36.4           
 [41] stringr_1.2.0                 rvest_0.3.2                   mime_0.5                      ensembldb_2.0.3              
 [45] XML_3.98-1.9                  AnnotationHub_2.8.2           zlibbioc_1.22.0               scales_0.4.1                 
 [49] BSgenome_1.44.0               VariantAnnotation_1.22.3      BiocInstaller_1.26.0          hms_0.3                      
 [53] ProtGenerics_1.8.0            SummarizedExperiment_1.6.3    RBGL_1.52.0                   AnnotationFilter_1.0.0       
 [57] RColorBrewer_1.1-2            yaml_2.1.14                   curl_2.7                      memoise_1.1.0                
 [61] gridExtra_2.2.1               biomaRt_2.32.1                rpart_4.1-10                  reshape_0.8.6                
 [65] latticeExtra_0.6-28           stringi_1.1.5                 RSQLite_2.0                   checkmate_1.8.2              
 [69] GenomicFeatures_1.28.4        BiocParallel_1.10.1           rlang_0.1.1                   pkgconfig_2.0.1              
 [73] matrixStats_0.52.2            bitops_1.0-6                  lattice_0.20-33               bindr_0.1                    
 [77] GenomicAlignments_1.12.1      htmlwidgets_0.8               bit_1.1-12                    GGally_1.3.1                 
 [81] plyr_1.8.4                    magrittr_1.5                  R6_2.2.2                      Hmisc_4.0-3                  
 [85] DelayedArray_0.2.7            DBI_0.7                       haven_1.0.0                   foreign_0.8-66               
 [89] survival_2.41-3               RCurl_1.95-4.8                nnet_7.3-12                   modelr_0.1.0                 
 [93] OrganismDbi_1.18.0            grid_3.4.1                    readxl_1.0.0                  data.table_1.10.4            
 [97] blob_1.1.0                    forcats_0.2.0                 digest_0.6.12                 xtable_1.8-2                 
[101] httpuv_1.3.5                  munsell_0.4.3   

ulimit

One person suggested using ulimit. This works, but it's not clear how to accomplish this from within RStudio.

mint@hp ~ $ ulimit -s
8192
mint@hp ~ $ ulimit -s unlimited
mint@hp ~ $ R --slave -e 'Cstack_info()["size"]'
size 
  NA 

It's not because the computer does not have enough memory available (16GB).

RAppArmor

One person suggested to use RAppArmor to increase the limit from within R. However, the function no longer exists. But looking at the limit, there doesn't seem to be any problem.

> rlimit_as();
$hardlim
[1] 1.844674e+19

$softlim
[1] 1.844674e+19

ulimit from within RStudio

In the comments Yuval Ben-Arie suggested trying ulimit from within RStudio. I tried this both using RStudio's terminal and using system from R to run a system command. Neither affected the actual R session, nor after restarting R.


I ran out of things to try.


回答1:


It turned out to be due to some outdated packages. I did not notice that they were not updated because RStudio's 'update packages functionality' ignores packages one does not have write permission to (thus not informing you they are outdated at all). Thus, it turned out to be due a subtle permissions problem see. See this answer.




回答2:


The stack memory of each process is limited not only by available memory but also by OS (by default no more than a few MiBs).

I didn't understand whether ulimit -s unlimited did the trick or not. what does "it's not clear how to accomplish this from without RStudio" mean?



来源:https://stackoverflow.com/questions/45225966/genomicranges-c-stack-usage-is-too-close-to-the-limit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!