<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4417.0">
<TITLE>Segfault when using res_config_odbc on x86_64</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>I'm trying to move our asterisk setup from an i686 server to an x86_64 (Dual AMD Opteron) server. </FONT>
</P>
<P><FONT SIZE=2>Everything has been manually compiled: MySQL 4.1.10, MyODBC 3.51.11, unixODBC 2.2.10 (because I couldn't find any usable RPMs). And obviously Asterisk, where I'm using the STABLE release CVS-Nv1-0-5-02/21/05. The OS is Redhat Enterprise ES 4.0, kernel 2.6.9-5.0.3.ELsmp.</FONT></P>
<P><FONT SIZE=2>Asterisk is configured to read sip.conf and extensions.conf from MySQL via ODBC. The ast_config table contains about 3500 rows.</FONT></P>
<P><FONT SIZE=2>When I start "asterisk -gcvvvvv" the first time, everything works fine. Then I issue a "reload", and something strange happens:</FONT></P>
<BR>
<P><FONT SIZE=2> Reloading SIP</FONT>
<BR><FONT SIZE=2>Feb 22 09:50:23 NOTICE[26316]: config.c:764 __ast_load: Loading Config sip.conf via odbc engine</FONT>
<BR><FONT SIZE=2> == Parsing '/etc/asterisk/res_config_odbc.conf': Found</FONT>
<BR><FONT SIZE=2>Use EXIT or QUIT to exit the asterisk console</FONT>
<BR><FONT SIZE=2>*CLI> </FONT>
</P>
<BR>
<P><FONT SIZE=2>After that, basically nothing else happens, and asterisk still works. Now, if I issue another "reload", asterisk segfaults. That's what "bt" says inside gdb:</FONT></P>
<BR>
<P><FONT SIZE=2>(gdb) bt</FONT>
<BR><FONT SIZE=2>#0 0x0000002a9607df81 in my_strcasecmp_8bit () from /usr/local/lib/mysql/libmysqlclient_r.so.14</FONT>
<BR><FONT SIZE=2>#1 0x0000002a96075e71 in get_charset_number () from /usr/local/lib/mysql/libmysqlclient_r.so.14</FONT>
<BR><FONT SIZE=2>#2 0x0000002a960761a6 in get_charset_by_csname () from /usr/local/lib/mysql/libmysqlclient_r.so.14</FONT>
<BR><FONT SIZE=2>#3 0x0000002a960909a2 in mysql_real_connect () from /usr/local/lib/mysql/libmysqlclient_r.so.14</FONT>
<BR><FONT SIZE=2>#4 0x0000002a95f28ba3 in SQLConnect () from /usr/local/lib/libmyodbc3_r.so</FONT>
<BR><FONT SIZE=2>#5 0x0000002a95baf4e9 in SQLConnect (connection_handle=0x655380, server_name=0x6007f0 "asterisk", name_length1=-4992, </FONT>
<BR><FONT SIZE=2> user_name=0x770300 "asterisk", name_length2=-6000, authentication=0x60cfb0 "*******", name_length3=-3)</FONT>
<BR><FONT SIZE=2> at SQLConnect.c:3796</FONT>
<BR><FONT SIZE=2>#6 0x0000002a9bd3e50b in odbc_init () at cdr_odbc.c:383</FONT>
<BR><FONT SIZE=2>#7 0x0000002a9bd3e877 in odbc_load_module () at cdr_odbc.c:305</FONT>
<BR><FONT SIZE=2>#8 0x0000000000411204 in ast_module_reload (name=0x0) at loader.c:184</FONT>
<BR><FONT SIZE=2>#9 0x000000000042f811 in handle_reload (fd=-1776674848, argc=1702130529, argv=0x6146a0) at cli.c:127</FONT>
<BR><FONT SIZE=2>#10 0x0000000000431b48 in ast_cli_command (fd=1, s=0x2a961a17e0 "\b") at cli.c:1155</FONT>
<BR><FONT SIZE=2>#11 0x0000000000447334 in main (argc=5986672, argv=0x5ae0d0) at asterisk.c:706</FONT>
</P>
<BR>
<P><FONT SIZE=2>I'm not sure what the problem could be. What's interesting is that I can issue "sip reload" or "extensions reload" as much as I want and it won't segfault. But two plain "reload"s in a row will crash it.</FONT></P>
<P><FONT SIZE=2>Anyone?</FONT>
</P>
<P><FONT SIZE=2>Thank you</FONT>
<BR><FONT SIZE=2>-Manuel</FONT>
</P>
</BODY>
</HTML>