<p>I am running OpenSIPS 2.1 latest from git, and seeing a strange issue with dialplan module in conjunction with postgresql. Basically opensips will not start, even with an empty dialplan table and is terminated with a SIGBUS. </p>

<p>The problem still happens with some rows in dialplan table, but disappears if I comment out dialplan module and call to dp_translate.</p>

<p>I have not tried to replicate with MySQL</p>

<p>OpenSIPs version is</p>

<p>version: opensips 2.1.1 (x86_64/linux)<br>
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT<br>
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535<br>
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.<br>
git revision: <a href="https://github.com/OpenSIPS/opensips/commit/4963c7c4fadadf17504932f397304499ebf6e02e" class="commit-link"><tt>4963c7c</tt></a><br>
main.c compiled on 08:24:30 Sep 28 2015 with gcc 4.9.2</p>

<p>Log output is</p>

<p>Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_submit_query: 0x7fca723c2b60 PQsendQuery(select dpid,pr,match_op,match_exp,match_flags,subst_exp,repl_exp,attrs,timerec from dialplan where disabled=0 order by pr)<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:core:db_new_result: allocate 48 bytes for result set at 0x7fca723c2cf8<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_fetch_result: 0x7fca723c2b60 PQresultStatus(PGRES_TUPLES_OK) PQgetResult(0x242a680)<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: 9 columns returned from the query<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:core:db_allocate_columns: allocate 252 bytes for result columns at 0x7fca723c2dc0<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e08)[0]=[dpid]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e18)[1]=[pr]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e28)[2]=[match_op]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e38)[3]=[match_exp]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e48)[4]=[match_flags]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_INT result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e58)[5]=[subst_exp]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e68)[6]=[repl_exp]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e78)[7]=[attrs]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: RES_NAMES(0x7fca723c2e88)[8]=[timerec]<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: DBG:db_postgres:db_postgres_get_columns: use DB_STRING result type<br>
Sep 28 08:47:16 opensips01 opensips-reg[20519]: WARNING:dialplan:dp_load_db: no data in the db<br>
Sep 28 08:47:16 opensips01 opensips-reg[20513]: DBG:core:handle_sigs: status = 135<br>
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:handle_sigs: child process 20519 exited by a signal 7<br>
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:handle_sigs: core was generated<br>
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:handle_sigs: terminating due to SIGCHLD<br>
Sep 28 08:47:16 opensips01 opensips-reg[20515]: INFO:core:sig_usr: signal 15 received<br>
Sep 28 08:47:16 opensips01 opensips-reg[20518]: INFO:core:sig_usr: signal 15 received<br>
Sep 28 08:47:16 opensips01 opensips-reg[20514]: INFO:core:sig_usr: signal 15 received<br>
Sep 28 08:47:16 opensips01 opensips-reg[20516]: INFO:core:sig_usr: signal 15 received<br>
Sep 28 08:47:16 opensips01 opensips-reg[20517]: INFO:core:sig_usr: signal 15 received<br>
Sep 28 08:47:16 opensips01 opensips-reg[20513]: INFO:core:cleanup: cleanup</p>

<p>Backtrace output is</p>

<p>Core was generated by `/usr/local/opensips_proxy/sbin/opensips -P /var/run/opensips/opensips.pid -m 64'.<br>
Program terminated with signal SIGBUS, Bus error.<br>
#0  destroy_hash (rules_hash=0x7fca64cd1790) at dp_db.c:671<br>
671             for (rulep = indexp-&gt;first_rule; rulep; rulep=indexp-&gt;first_rule) {<br>
(gdb) bt<br>
#0  destroy_hash (rules_hash=0x7fca64cd1790) at dp_db.c:671<br>
<a href="https://github.com/OpenSIPS/opensips/issues/1" class="issue-link" title="Dummy ticket">#1</a>  0x00007fca6b8c92ec in dp_load_db (dp_conn=dp_conn@entry=0x7fca64cd1790) at dp_db.c:343<br>
<a href="https://github.com/OpenSIPS/opensips/issues/2" class="issue-link" title="Dummy issue">#2</a>  0x00007fca6b8c9903 in init_db_data (dp_connection=dp_connection@entry=0x7fca64cd1790) at dp_db.c:126<br>
<a href="https://github.com/OpenSIPS/opensips/pull/3" class="issue-link" title="Compilation problem under CentOS 6">#3</a>  0x00007fca6b8b7b52 in child_init (rank=) at dialplan.c:532<br>
<a href="https://github.com/OpenSIPS/opensips/pull/4" class="issue-link" title="Compilation problem under CentOS 6">#4</a>  0x00000000004e5167 in init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237b308) at sr_module.c:552<br>
<a href="https://github.com/OpenSIPS/opensips/pull/5" class="issue-link" title="spec file update to CentOS 6">#5</a>  init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237b878) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/issues/6" class="issue-link" title="Wrong password column used for authentication">#6</a>  init_mod_child (m=0x7fca7237b958, rank=1, type=0x5d2090 "CHILD") at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/7" class="issue-link" title="b2bua: Add AVP-based authentication">#7</a>  0x00000000004e4f5f in init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237cec8) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/issues/8" class="issue-link" title="Flag to set string to lower for RURI/From/To/Contact">#8</a>  init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237d818) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/issues/9" class="issue-link" title="segfault on fm_malloc">#9</a>  init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237dac0) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/issues/10" class="issue-link" title="Set exchange and routing-key for event_rabbitmq module">#10</a> init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237e7d8) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/issues/11" class="issue-link" title="Set exchange and routing-key for the event_rabbitmq module">#11</a> init_mod_child (m=0x7fca7237e960, rank=1, type=0x5d2090 "CHILD") at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/12" class="issue-link" title="Install Notes">#12</a> 0x00000000004e4f5f in init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237eb40) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/13" class="issue-link" title="1.8">#13</a> init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237ec78) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/14" class="issue-link" title="Added presence federation algorithm.">#14</a> init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237f8f0) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/15" class="issue-link" title="Ds better pua dialoginfo">#15</a> init_mod_child (type=0x5d2090 "CHILD", rank=1, m=0x7fca7237fa20) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/16" class="issue-link" title="Fix PUA module so that it sends a final PUBLISH on expiration.">#16</a> init_mod_child (m=0x7fca7237fba0, rank=1, type=0x5d2090 "CHILD") at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/17" class="issue-link" title="Revert commit 4b29352e.">#17</a> 0x00000000004e84eb in init_mod_child (type=, rank=1, m=0x7fca72380738) at sr_module.c:546<br>
<a href="https://github.com/OpenSIPS/opensips/pull/18" class="issue-link" title="We now rely on libxml api instead of cut/paste.">#18</a> init_child (rank=1) at sr_module.c:595<br>
<a href="https://github.com/OpenSIPS/opensips/pull/19" class="issue-link" title="Ds sst">#19</a> 0x000000000058c591 in udp_start_processes (chd_rank=chd_rank@entry=0x84c2ec , startup_done=startup_done@entry=0x7fca64d4ed58) at net/net_udp.c:424<br>
<a href="https://github.com/OpenSIPS/opensips/pull/20" class="issue-link" title="Fixed presentity naming.">#20</a> 0x000000000041a9d3 in main_loop () at main.c:722<br>
<a href="https://github.com/OpenSIPS/opensips/issues/21" class="issue-link" title="Opensips 1.9.1 with TLS fails to start on Fedora 18">#21</a> main (argc=, argv=) at main.c:1259<br>
(gdb)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/655">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOcieCMk8bIj03i1Lkc4esv0eDZ2FF6ks5o2SHagaJpZM4GE2ka.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/655"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>