New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating database with small mapsize produces segfault #36
Comments
Not getting that here:
Did you do anything special to install liblmdb separately from the gem, or did you install only the gem (which should be fine)? |
I didn't install liblmdb separately, just through the gem. Also, I installed the gem on a 2nd Mac OS X system and received the same result. Did you try creating an empty directory first? I get two different results (although, not the same as yours) depending on the state of the dir: $ mkdir db # <-- empty dir
$ irb -rlmdb
irb(main):001:0> db = LMDB.new('db', mapsize: 1000)
(irb):1: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
# ... etc ... $ rm -rf db
$ irb -rlmdb
irb(main):001:0> LMDB.new('db', mapsize: 1000)
LMDB::Error: No such file or directory
from (irb):1:in `new'
from (irb):1
from /Users/duane/.rbenv/versions/1.9.3-p194/bin/irb:12:in `<main>' |
The second error is expected. LMDB.new doesn't try to create a directory. Are you seeing similar errors with larger mapsize values? The default is 1MB. |
Not for very large sizes. I tried several sizes, though, and it looks like 4100 is the smallest size I can go without a segfault. Maybe we're hitting a 4096 byte bug?
require 'fileutils'
size = 1_000_000
while size > 0
FileUtils.rm_rf 'db'
FileUtils.mkdir 'db'
puts size
db = LMDB.new('db', mapsize: size)
db.close
size -= 100
end Running with # ...
5000
4900
4800
4700
4600
4500
4400
4300
4200
4100
4000
lmdb_test.rb:9: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
-- Control frame information -----------------------------------------------
c:0004 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :new
c:0003 p:0100 s:0008 b:0008 l:001dc8 d:001728 EVAL lmdb_test.rb:9
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001dc8 d:001dc8 TOP |
Maybe it's a bug of MDB specific to osx? Can you recreate this with a C program? |
It's certainly possible. I don't have the time to work further on this, but
|
One possible clue: the page size on OS X is 4k. -r On Oct 3, 2014, at 6:54 PM, Duane Johnson notifications@github.com wrote:
|
The text was updated successfully, but these errors were encountered: