twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
274 stars 89 forks source link

MemoryError: std::bad_alloc #71

Open TomGoBravo opened 4 years ago

TomGoBravo commented 4 years ago

I'm having trouble getting python-rocksdb running. I followed https://github.com/twmht/python-rocksdb#quick-install with the small change of git checkout v6.3.6 of facebook/rocksdb and running make install instead of putting paths in the shell env variables. I picked the latest from the 6.3 tree because I see 6.4 introduced some changes to the column family API I wanted to avoid whatever is triggering https://github.com/twmht/python-rocksdb/issues/70. With python-rocksdb 0.7.0 even https://github.com/twmht/python-rocksdb#quick-usage-guide fails:

Python 3.6.2 (default, Oct 17 2017, 21:26:29) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rocksdb
>>> 
>>> db = rocksdb.DB("test.db", rocksdb.Options(create_if_missing=True))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "rocksdb/_rocksdb.pyx", line 1589, in rocksdb._rocksdb.DB.__cinit__
MemoryError: std::bad_alloc

Like issue 70, I first ran into this problem on my laptop running gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516 and Python 3.6.8. I reproduced it in a container on a server running gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 and Python 3.6.8.

TomGoBravo commented 4 years ago

The code at "rocksdb/_rocksdb.pyx", line 1589 is related to column families:

           # Always add the default column family
            column_family_descriptors.push_back(
                db.ColumnFamilyDescriptor(
                    db.kDefaultColumnFamilyName,
                    options.ColumnFamilyOptions(deref(opts.opts))
                )
            )