Crash with memory mapped files

324 views
Skip to first unread message

Scott Carey

unread,
Mar 10, 2015, 6:37:05 PM3/10/15
to ma...@googlegroups.com
This appears similar to https://groups.google.com/forum/#!topic/mapdb/PIfjkv8mDZM

But I'm not sure.

Caused by: java.io.IOException: Map failed
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:892)
        at org.mapdb.Volume$MappedFileVol.makeNewBuffer(Volume.java:534)
        ... 38 more
Caused by: java.lang.OutOfMemoryError: Map failed
        at sun.nio.ch.FileChannelImpl.map0(Native Method)
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:889)
        ... 39 more
Java HotSpot(TM) 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed.
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f13dd8ec000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)


I am opening about 200 databases that total about 200GB of file space, on a server with much less RAM.  It fails about half way through opening them.  I am opening them in read-only mode, so hopefully they are not corrupted.

This is a little confusing, as I would expect the virtual memory to be 'free' on a 64 bit system.  I have not accessed it, at this point I am only opening the databases and asking for what objects are in there.

There is some information here http://javarevisited.blogspot.com/2014/11/javaioioexception-map-failed-javalangoutofmemoryerror.html  but that seems more related to 32 bit systems.
This one is more promising : https://blog.kumina.nl/2011/04/cassandra-java-io-ioerror-java-io-ioexception-map-failed/  -- I'll report back if this fixes it, that would be relatively pleasant.

What other tips are there?  Is this expected to work?  I'm working with datasets regularly close to 10x the RAM on the machine, and memory mapped files should really help out the performance in this situation.  Or so I have hoped.

Scott Carey

unread,
Mar 10, 2015, 7:46:14 PM3/10/15
to ma...@googlegroups.com


On Tuesday, March 10, 2015 at 3:37:05 PM UTC-7, Scott Carey wrote:
This appears similar to https://groups.google.com/forum/#!topic/mapdb/PIfjkv8mDZM

But I'm not sure.

Caused by: java.io.IOException: Map failed
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:892)
        at org.mapdb.Volume$MappedFileVol.makeNewBuffer(Volume.java:534)
        ... 38 more
Caused by: java.lang.OutOfMemoryError: Map failed
        at sun.nio.ch.FileChannelImpl.map0(Native Method)
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:889)
        ... 39 more
Java HotSpot(TM) 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed.
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00007f13dd8ec000, 12288, 0) failed; error='Cannot allocate memory' (errno=12)


I am opening about 200 databases that total about 200GB of file space, on a server with much less RAM.  It fails about half way through opening them.  I am opening them in read-only mode, so hopefully they are not corrupted.

This is a little confusing, as I would expect the virtual memory to be 'free' on a 64 bit system.  I have not accessed it, at this point I am only opening the databases and asking for what objects are in there.

There is some information here http://javarevisited.blogspot.com/2014/11/javaioioexception-map-failed-javalangoutofmemoryerror.html  but that seems more related to 32 bit systems.
This one is more promising : https://blog.kumina.nl/2011/04/cassandra-java-io-ioerror-java-io-ioexception-map-failed/  -- I'll report back if this fixes it, that would be relatively pleasant.

sysctl -w vm.max_map_count=1024000

worked.  Since MapDB uses 1MB mappings, this would allow about 1TB of total files to be mapped.

Right after that worked, I hit OOM however, as I had not set it to use weak caches (I thought these were the default). 
Reply all
Reply to author
Forward
0 new messages