python-ibmdb: malloc error: pointer being freed was not allocated

After reinstalling the idmdb2 package, this symbol not found error disappeard (https://github.com/ibmdb/python-ibmdb/issues/691). However, a new error occures when call the ibm_db.connect function:

python(2472,0x201366600) malloc: *** error for object 0x7ffb559e3800: pointer being freed was not allocated python(2472,0x201366600) malloc: *** set a breakpoint in malloc_error_break to debug

I’m running OSX Monterey and Python 3.9 via Anaconda.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

@instakarlo @Dagdelo This issue should be fixed now. If you still face it, please delete the clidriver directory /Users/henriquedelgadosales/.pyenv/versions/venv-II-API/lib/python3.9/site-packages/clidriver and go for fresh installation. Issue should be fixed now. If still you see any problem, then rename clidriver\lib\libstdc++.* library. It should be good. Thanks.

I tried to reproduce the fix several times with differents python versions. Can someone please help me how to do it? I’m using the pyenv-virtualenv. This is my $DYLD_LIBRARY_PATH: export DYLD_LIBRARY_PATH=/Users/henriquedelgadosales/.pyenv/versions/venv-II-API/lib/python3.9/site-packages/clidriver.

My pip list | grep "ibm":

ibm-db 3.1.0 ibm-db-sa 0.3.7

My output whe trying to run the app:

sql_select : DEBUG connecting with Engine(db2://db2inst1:@…😉 2022-01-17 11:15 sql_select DEBUG connecting with Engine(db2://db2inst1:@…😉 python(43302,0x10e0a6600) malloc: *** error for object 0x7ffb47865300: pointer being freed was not allocated python(43302,0x10e0a6600) malloc: *** set a breakpoint in malloc_error_break to debug [3] 43302 abort python data-api/run.py

Double checked env:

echo $DYLD_LIBRARY_PATH /Users/henriquedelgadosales/.pyenv/versions/venv-II-API/lib/python3.9/site-packages/clidriver

For me I did the following (but not sure if it’ll work in your environment since different people have different solutions):

I upgraded gcc using brew update gcc I upgraded my ibm_db to 3.1.1 in requirements file and did a new install in virtual env then deactivate virtual env again

Before I activate my virtual env again, I ran (check ur path seems different paths for different people) export DYLD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/clidriver/lib

Then I modified .venv/bin/activate to add the following lines: export DYLD_LIBRARY_PATH="$VIRTUAL_ENV/lib/clidriver/lib"

After that I activate my virtual env: source .venv/bin/activate

Also, Mac is asking for another upgrade, but I think I won’t upgrade for now

good luck!

@amukherjee28 @bimalkjha

Hi I am facing this issue as well when trying to call ibm_db.pconnect on macOS Monterey version 12.0.1 Intel chip, Python version 3.9.9 and fresh install of ibm-db==3.1.1, how can I resolve this? Thanks.

Okay finally got this working, updated the version of gcc/g++ on my Mac using brew update gcc (gcc: stable 11.2.0). Then uninstalled/reinstalled ibm-db 3.1.1 and then also ran the command to update the DYLD_LIBRARY_PATH env variable:

export DYLD_LIBRARY_PATH=/usr/local/lib/python3.9/site-packages/clidriver/lib:$DYLD_LIBRARY_PATH

@amukherjee28 @Dagdelo just tested this, but it doesn’t work. I’m also quite sure that the correct clidriver folder is found, because when I delete that folder, other errors pop up.

@Dagdelo @arlon-nlo

Could you please try setting the DYLD_LIBRARY_PATH to the lib folder of the clidriver and check again. I had the issue initially for some people in Monterey and seems that this approach worked for them.

Just try and set the following path

export DYLD_LIBRARY_PATH=<full path to clidriver>/lib:$DYLD_LIBRARY_PATH

Please let me know if this works for now.

Thanks

As soon we test it in the new OS I will update this issue. I have tagged this as new OS support for now.