[Bioc-devel] R version-dependent segfault

Vladimir Kiselev vladimir.yu.kiselev at gmail.com
Thu Jan 5 12:41:57 CET 2017


My package (SC3 - http://bioconductor.org/packages/3.4/bioc/html/SC3.html)
has a function that causes R version/platform-dependent seqfault. Here is
the function (it's in C++ using RccpArmadillo):

arma::mat norm_laplacian(arma::mat A) {
    A = exp(-A/A.max());
    arma::rowvec D_row = pow(sum(A), -0.5);
    A.each_row() %= D_row;
    colvec D_col = conv_to< colvec >::from(D_row);
    A.each_col() %= D_col;
    arma::mat res = eye(A.n_cols, A.n_cols) - A;
    return(res);
}

The test code that provides a segfault on some R versions/platforms:
SC3::norm_laplacian(matrix(runif(100), nrow = 10))

The segfault usually looks like this:
*** caught segfault ***
address 0x7ffdc981e000, cause 'memory not mapped'

(where address can be a different sequence)

So far by a collaborative effort (me and some users of the package) we
figured out configurations that cause or do not cause a segfault:

* Configurations causing a segfault:

R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.10

* Configurations causing no segfault:

R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

R version 3.3.0 (2016-05-03)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)

R Under development (unstable) (2016-10-20 r71540)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X Yosemite 10.10.5

More details on our discussion can be found here:
https://github.com/hemberg-lab/SC3/issues/33

Has anybody had a similar issue? Do you have any suggestions on how to fix
this, except rewriting the function in R? Or maybe there already exists a
normalised Laplacian function written in C++?

Many thanks,
Cheers,
Vladimir
-- 
http://genat.uk

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list