'invalid pointer' with ODBC on CentOS 7

1

I'm running into an 'invalid pointer' with ODBC on a CentOS 7 machine while developing a new Asterisk (PBX) configuration.

A previous server with identical set-up (unixODBC version 2.3.1) works fine. But when I re-install everything on a new server, I get the following error while testing the ODBC connection.

# isql -v asterisk-connector
*** Error in `isql': munmap_chunk(): invalid pointer: 0x0000000001cb2728 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7f5d4)[0x7f476735d5d4]
/usr/lib64/libmyodbc5.so(MySQLGetPrivateProfileStringW+0x104)[0x7f47605563c4]
/usr/lib64/libmyodbc5.so(ds_lookup+0x5d)[0x7f4760555ced]
/usr/lib64/libmyodbc5.so(MySQLConnect+0xc6)[0x7f47605394c6]
/lib64/libodbc.so.2(SQLConnect+0xa63)[0x7f4767f2b3b3]
isql[0x4028a9]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f47673003d5]
isql[0x402c39]
======= Memory map: ========

The ODBC configuration is as follows:

==> /etc/odbc.ini <==
[asterisk-connector]
Description= MySQL connection to 'asterisk' database
Driver= MySQL
Database= asterisk
Server= localhost
User= asterisk
Password= secretpasswd
Port= 3306
Socket= /var/lib/mysql/mysql.sock

==> /etc/odbcinst.ini <==
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description     = ODBC for MySQL
Driver64        = /usr/lib64/libmyodbc5w.so
Setup64         = /usr/lib64/libodbcmyS.so
FileUsage       = 1

# odbcinst -j
unixODBC 2.3.1
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

At this point I feel like I have compared both servers to the last bit on their drives and scanned the internet for similar issues, and I have no idea what to do anymore.

SOLVED:
This issue was caused because a MySQL ODBC connector was being used for a incompatible MariaDB database.

Solved by downloading the correct driver (in my case http://repo.mysql.com/yum/mysql-connectors-community/el/7/x86_64//mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm) and editing the odbcinst.ini file as follows:

[MySQL ODBC 8.0 Unicode Driver]
Driver=/usr/lib64/libmyodbc8w.so
UsageCount=1

[MySQL ODBC 8.0 ANSI Driver]
Driver=/usr/lib64/libmyodbc8a.so
UsageCount=1

Lots of thanks to @Pimp Juice IT and my co-worker!
I hope this helps others who experience this issue.

Olivier

Posted 2019-02-10T14:30:19.990

Reputation: 11

What's the output that shows when you run odbcinst -q -d? Also if you put the username and password in the command rather than in the odbc.ini file, does that make any difference for your result when you run? I assume you confirmed the asterisk SQL login exists already and has been granted access to the DB it needs to access, right? – Pimp Juice IT – 2019-02-10T15:53:43.687

Thanks for your input! odbcinst -q -d shows only one configured driver: [MySQL] I didn't try providing the parameters to the isql command, but I get the same result when I do # isql -v asterisk-connector asterisk secretpasswd In MySQL CLI everything works fine. – Olivier – 2019-02-10T17:05:52.313

Does using Server= 127.0.0.1 in the ini config file versus localhost make any difference for your result? Not sure if the MySQL service needs restarted or not after making such changes, but if you can, in the name of thoroughness, that's what I'd do after setting and before testing the change. – Pimp Juice IT – 2019-02-10T17:08:23.580

Wow, hadn't even thought of that! I just tried everything again, at first no difference, but with isql -v asterisk-connector asterisk secretpasswd I now get Segmentation fault – Olivier – 2019-02-10T17:27:16.310

If I don't provide the username/password, I just get the same munmap_chunk(): invalid pointer error – Olivier – 2019-02-10T17:28:12.847

Double check your MySQL config file and see how you have it listening binding wise or whatever. It almost sounds like a password mismatch or something like that or denied authentication. I assume you are running this from the localhost itself and not from a remote machine but it seems odd keeping out the password gives the same error as you got initially with the password using localhost and that's what make me think it's an authentication issue. – Pimp Juice IT – 2019-02-10T17:30:51.930

Read over this post and some of the comments, etc. regarding method used for further troubleshooting, etc. https://bbs.archlinux.org/viewtopic.php?id=187129 I'm not 100% certain if anything here will help, but should be worth a read and a shot just in case. I see they run commands to test the ODCB connections in particular and then there's something about setting another package to not get global updates and a MySQL bug, etc. If nothing else, you waste a few minutes reading over a post worst case.

– Pimp Juice IT – 2019-02-10T17:38:56.083

Answers

0

SOLVED:
This issue was caused because a MySQL ODBC connector was being used for a incompatible MariaDB database.

Solved by downloading the correct driver (in my case http://repo.mysql.com/yum/mysql-connectors-community/el/7/x86_64//mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm)
and editing the odbcinst.ini file as follows:

[MySQL ODBC 8.0 Unicode Driver]
Driver=/usr/lib64/libmyodbc8w.so
UsageCount=1

[MySQL ODBC 8.0 ANSI Driver]
Driver=/usr/lib64/libmyodbc8a.so
UsageCount=1

Lots of thanks to @Pimp Juice IT and my co-worker!
I hope this helps others who experience this issue.

Olivier

Posted 2019-02-10T14:30:19.990

Reputation: 11