kaneplusplus / bigmemory

126 stars 24 forks source link

big.matrix object creation fails consistently in docker containers #81

Open paulklemm opened 6 years ago

paulklemm commented 6 years ago

I encountered a reproducible problem when creating big.matrix objects using a Debian docker container. The same also happens for a different one running Ubuntu.

To reproduce, you only need to take the following steps:

# Pull the r-base package
docker pull r-base
# Run R using an interactive shell on the image
docker run -ti --rm r-base /usr/bin/R

In the interactive R session, you run:

# Install bigmemory
install.packages('bigmemory')
# Load the package and run tests
library(bigmemory)
# Works
x <- big.matrix(5, 2)
# BUS error
x <- big.matrix(53110, 1540)

The last command yields the following error:

 *** caught bus error ***
address 0x7fa154ffc000, cause 'non-existent physical address'

Traceback:
 1: .Call(`_bigmemory_CreateSharedMatrix`, row, col, colnames, rownames,     typeLength, ini, separated)
 2: CreateSharedMatrix(as.double(nrow), as.double(ncol), as.character(colnames),     as.character(rownames), as.integer(typeVal), as.double(init),     as.logical(separated))
 3: big.matrix(53110, 1540)

The code works on the R version on my Mac without problems. The same code in the docker container yielded the described problem. I've also tested the docker container on a Linux machine with over 60GB RAM (which the docker container can access) and the outcome remains the same.

@kaneplusplus already asked whether this is a 64-bit Linux. uname -i yields x86_64, so this shouldn't be the problem.

privefl commented 6 years ago

Have you tried with shared = FALSE or using a filebacked big.matrix?

zhiiiyang commented 3 years ago

@paulklemm, I encountered the same problem in a docker environment as well. But using shared = FALSE made the bug go away.

kaneplusplus commented 3 years ago

This might indicate a memory mapping issue. Can you try creating a much smaller big.matrix object, like 10x10, and see if you get the same error?