wbolster / plyvel

Plyvel, a fast and feature-rich Python interface to LevelDB
https://plyvel.readthedocs.io/
Other
529 stars 75 forks source link

Unexpected memory-related error when used in IPython? #72

Closed fasiha closed 6 years ago

fasiha commented 6 years ago

When I install plyvel and IPython in a fresh virtualenv (Python 3.6.4), I encounter an unexpected memory-related error when closing IPython that I don't see when I use plain Python, specifically, src/tcmalloc.cc:331] Attempt to free invalid pointer 0x7fcce28480f0.

For example, creating a fresh virtualenv, installing the two packages, and just importing plyvel in IPython shows the warning, while the same import in Python seems fine:

$ mkdir p
$ virtualenv .
$ . bin/activate
$ pip install ipython plyvel
# open new tab and activate virtualenv there so the new ipython is picked up
$ ipython
Python 3.6.4 (default, Mar 27 2018, 21:05:05)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import plyvel

In [2]:
Do you really want to exit ([y]/n)? ^D
src/tcmalloc.cc:331] Attempt to free invalid pointer 0x7fcce28480f0
[1]    84695 abort      ipython
$ python
Python 3.6.4 (default, Mar 27 2018, 21:05:05)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import plyvel
>>>
$ 

pip freeze says I have plyvel==1.0.4 and ipython==6.2.1 (and all their dependencies). Note that I don't encounter any problems using plyvel, just, when I close IPython after working with plyvel I see this error and not knowing why is causing me mild heartburn. Thanks, I love plyvel!

wbolster commented 6 years ago

this is on osx it seems? (judging from the python startup message.)

i cannot reproduce on linux:

$ ipython
[Python 3.6.3, IPython 6.3.0, sys.prefix ~/.virtualenvs/tmp-5254c794d5a5619a]
>>> import plyvel
>>>                                                                                                                     
Do you really want to exit ([y]/n)?

$

does this also happen with plain python?

evandrix commented 4 years ago

bump

wbolster commented 4 years ago

bump

not sure what you think you're doing, but you're just adding noise, @evandrix

virtualgraham commented 4 years ago

I also experienced the error "Attempt to free invalid pointer" using Jupyter Lab on Mac when importing the Plyvel library. However, the workaround was to move the import statement and database accessor function into a separate .py file and simply import that file into the notebook and call your functions as needed.