Asterisk crashes on res_odbc.so load

asterisk-invalid-pointerWhile loading res_odbc.so Asterisk crashes with “invalid pointererror like in the backtrace below:

Loading res_odbc.so.
*** Error in `asterisk’: munmap_chunk(): invalid pointer: 0x0000000001455078 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7f5d4)[0x7f1bc59c35d4]
/usr/lib64/libmyodbc5.so(MySQLGetPrivateProfileStringW+0x104)[0x7f1b578103c4]
/usr/lib64/libmyodbc5.so(ds_lookup+0x5d)[0x7f1b5780fced]
/usr/lib64/libmyodbc5.so(MySQLConnect+0xc6)[0x7f1b577f34c6]
/lib64/libodbc.so.2(SQLConnect+0xa63)[0x7f1b61bf73b3]
/usr/lib/asterisk/modules/res_odbc.so(_ast_odbc_request_obj2+0x42f)[0x7f1b61e52fbf]
/usr/lib/asterisk/modules/res_odbc.so(_ast_odbc_request_obj+0x17)[0x7f1b61e535d7]
/usr/lib/asterisk/modules/res_odbc.so(+0x531a)[0x7f1b61e5431a]
/usr/lib/asterisk/modules/res_odbc.so(+0x59c8)[0x7f1b61e549c8]
asterisk[0x4fa9c8]
asterisk[0x4fb1de]
asterisk[0x4fe0f4]
asterisk[0x438285]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f1bc59663d5]
asterisk[0x4392b3]
======= Memory map: ========
00400000-006bd000 r-xp 00000000 fd:00 1264113 /usr/sbin/asterisk
008bc000-008bd000 r–p 002bc000 fd:00 1264113 /usr/sbin/asterisk
008bd000-008e3000 rw-p 002bd000 fd:00 1264113 /usr/sbin/asterisk
008e3000-008f8000 rw-p 00000000 00:00 0
01349000-02b4a000 rw-p 00000000 00:00 0 [heap]
7f1b50af9000-7f1b57023000 r–p 00000000 fd:00 33558099 /usr/lib/locale/locale-archive
7f1b57023000-7f1b57343000 r-xp 00000000 fd:00 18114 /usr/lib64/libmysqlclient.so.18.0.0
7f1b57343000-7f1b57542000 —p 00320000 fd:00 18114 /usr/lib64/libmysqlclient.so.18.0.0
7f1b57542000-7f1b5754a000 r–p 0031f000 fd:00 18114 /usr/lib64/libmysqlclient.so.18.0.0
7f1b5754a000-7f1b575bd000 rw-p 00327000 fd:00 18114 /usr/lib64/libmysqlclient.so.18.0.0
7f1b575bd000-7f1b575c7000 rw-p 00000000 00:00 0
7f1b575c7000-7f1b575d7000 r-xp 00000000 fd:00 884021 /usr/lib64/libodbcinst.so.2.0.0
7f1b575d7000-7f1b577d7000 —p 00010000 fd:00 884021 /usr/lib64/libodbcinst.so.2.0.0
7f1b577d7000-7f1b577d8000 r–p 00010000 fd:00 884021 /usr/lib64/libodbcinst.so.2.0.0
7f1b577d8000-7f1b577d9000 rw-p 00011000 fd:00 884021 /usr/lib64/libodbcinst.so.2.0.0
7f1b577d9000-7f1b5781d000 r-xp 00000000 fd:00 3221829 /usr/lib64/libmyodbc5w.so
7f1b5781d000-7f1b57a1d000 —p 00044000 fd:00 3221829 /usr/lib64/libmyodbc5w.so
7f1b57a1d000-7f1b57a1f000 r–p 00044000 fd:00 3221829 /usr/lib64/libmyodbc5w.so
7f1b57a1f000-7f1b57a2e000 rw-p 00046000 fd:00 3221829 /usr/lib64/libmyodbc5w.so
7f1b57a2e000-7f1b57a30000 r-xp 00000000 fd:00 33565798 /usr/lib64/gconv/ISO8859-1.so
7f1b57a30000-7f1b57c2f000 —p 00002000 fd:00 33565798 /usr/lib64/gconv/ISO8859-1.so
7f1b57c2f000-7f1b57c30000 r–p 00001000 fd:00 33565798 /usr/lib64/gconv/ISO8859-1.so
7f1b57c30000-7f1b57c31000 rw-p 00002000 fd:00 33565798 /usr/lib64/gconv/ISO8859-1.so
7f1b57c31000-7f1b57c3d000 r-xp 00000000 fd:00 1458 /usr/lib64/libnss_files-2.17.so
7f1b57c3d000-7f1b57e3c000 —p 0000c000 fd:00 1458 /usr/lib64/libnss_files-2.17.so
7f1b57e3c000-7f1b57e3d000 r–p 0000b000 fd:00 1458 /usr/lib64/libnss_files-2.17.so
7f1b57e3d000-7f1b57e3e000 rw-p 0000c000 fd:00 1458 /usr/lib64/libnss_files-2.17.so
7f1b57e3e000-7f1b57e44000 rw-p 00000000 00:00 0
7f1b57e44000-7f1b57e46000 r-xp 00000000 fd:00 1264066 /usr/lib/asterisk/modules/res_ari_playbacks.so
7f1b57e46000-7f1b58045000 —p 00002000 fd:00 1264066 /usr/lib/asterisk/modules/res_ari_playbacks.so
7f1b58045000-7f1b58046000 r–p 00001000 fd:00 1264066 /usr/lib/asterisk/modules/res_ari_playbacks.so
7f1b58046000-7f1b58047000 rw-p 00002000 fd:00 1264066 /usr/lib/asterisk/modules/res_ari_playbacks.so
7f1b58047000-7f1b58051000 r-xp 00000000 fd:00 1264045 /usr/lib/asterisk/modules/res_ari_bridges.so
7f1b58051000-7f1b58250000 —p 0000a000 fd:00 1264045 /usr/lib/asterisk/modules/res_ari_bridges.so
7f1b58250000-7f1b58251000 r–p 00009000 fd:00 1264045 /usr/lib/asterisk/modules/res_ari_bridges.so
7f1b58251000-7f1b58252000 rw-p 0000a000 fd:00 1264045 /usr/lib/asterisk/modules/res_ari_bridges.so
7f1b58252000-7f1b58263000 r-xp 00000000 fd:00 1264040 /usr/lib/asterisk/modules/res_ari_channels.so
7f1b58263000-7f1b58462000 —p 00011000 fd:00 1264040 /usr/lib/asterisk/modules/res_ari_channels.so
7f1b58462000-7f1b58463000 r–p 00010000 fd:00 1264040 /usr/lib/asterisk/modules/res_ari_channels.so
7f1b58463000-7f1b58464000 rw-p 00011000 fd:00 1264040 /usr/lib/asterisk/modules/res_ari_channels.so
7f1b58464000-7f1b58470000 r-xp 00000000 fd:00 1263989 /usr/lib/asterisk/modules/func_odbc.so
7f1b58470000-7f1b5866f000 —p 0000c000 fd:00 1263989 /usr/lib/asterisk/modules/func_odbc.so
7f1b5866f000-7f1b58670000 r–p 0000b000 fd:00 1263989 /usr/lib/asterisk/modules/func_odbc.so
7f1b58670000-7f1b58671000 rw-p 0000c000 fd:00 1263989 /usr/lib/asterisk/modules/func_odbc.so
7f1b58671000-7f1b58675000 r-xp 00000000 fd:00 1264083 /usr/lib/asterisk/modules/res_ari_recordings.so
7f1b58675000-7f1b58874000 —p 00004000 fd:00 1264083 /usr/lib/asterisk/modules/res_ari_recordings.so
7f1b58874000-7f1b58875000 r–p 00003000 fd:00 1264083 /usr/lib/asterisk/modules/res_ari_recordings.so
7f1b58875000-7f1b58876000 rw-p 00004000 fd:00 1264083 /usr/lib/asterisk/modules/res_ari_recordings.so
7f1b58876000-7f1b5888a000 r-xp 00000000 fd:00 1264081 /usr/lib/asterisk/modules/res_agi.so
7f1b5888a000-7f1b58a89000 —p 00014000 fd:00 1264081 /usr/lib/asterisk/modules/res_agi.so
7f1b58a89000-7f1b58a8a000 r–p 00013000 fd:00 1264081 /usr/lib/asterisk/modules/res_agi.so
7f1b58a8a000-7f1b58a8e000 rw-p 00014000 fd:00 1264081 /usr/lib/asterisk/modules/res_agi.so
7f1b58a8e000-7f1b58a93000 r-xp 00000000 fd:00 1264080 /usr/lib/asterisk/modules/res_stasis_playback.so
7f1b58a93000-7f1b58c92000 —p 00005000 fd:00 1264080 /usr/lib/asterisk/modules/res_stasis_playback.so
7f1b58c92000-7f1b58c93000 r–p 00004000 fd:00 1264080 /usr/lib/asterisk/modules/res_stasis_playback.soAborted

Since CentOS 7 MySQL was replaced with MariaDB by default. However in the standard repo package mysql-connector-odbc is version 5.2.25 that is incompatible with MariaDB.

You need to download and install correct mysql-connector-odbc package for MariaDB from here:

http://repo.mysql.com/yum/mysql-connectors-community/el/7/x86_64//mysql-connector-odbc-8.0.15-1.el7.x86_64.rpm

Install mysql-connector-odbc on CentOS 7 for MariaDB:

 

Want me to do this for you? Drop me a line: itgalaxyzzz {at} gmail [dot] com