zhanxw / seqminer

Query sequence data (VCF/BCF1/BCF2, Tabix, BGEN, PLINK) in R
http://zhanxw.github.io/seqminer/
Other
30 stars 12 forks source link

seqminer::tabix.read Aborted (core dumped) #21

Closed yulijia closed 3 years ago

yulijia commented 3 years ago

Hi,

I want to read a tbi file from local, however, it shows the error message of " Aborted (core dumped)".

Could anyone help me to solve this issue?

Here is a demo to reproduce the bug.

 library(seqminer)
 if (.Platform$endian == "little") {
   fileName = system.file("vcf/all.anno.filtered.extract.vcf.gz", package = "seqminer")
   snp <- tabix.read(fileName, "1:196623337-196632470")
}
/usr/include/c++/8/bits/stl_vector.h:950: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) const [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; std::vector<_Tp, _Alloc>::const_reference = const std::__cxx11::basic_string<char>&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.
Aborted (core dumped)

R session info

library(seqminer) sessionInfo() R version 4.0.5 (2021-03-31) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: CentOS Linux 8

Matrix products: default BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.12.so

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

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

other attached packages: [1] seqminer_8.1

loaded via a namespace (and not attached): [1] compiler_4.0.5

yulijia commented 3 years ago

Fixed. A long Journey.

First of all, I need to figure out what causes the core dump error. From searching ^1, the CentOS and Fedora OS have introduced the D_GLIBCXX_ASSERTIONS flag to do Run-time bounds checking for C++ strings and containers ^3 .

seqminer package has buffer overflows that will throw this error message when run tabix.read() due to it was compiled with D_GLIBCXX_ASSERTIONS by default.

After that, I need to recompile the package without D_GLIBCXX_ASSERTIONS flag. There are multiple ways^4 to do it. I choose to change the global settings (/usr/lib64/R/etc/Makeconf) for compiling it.

BTW, to check the default CXXFLAGS used in R, run R CMD config CXXFLAGS in the terminal.