<p>I didn't read the docs to find out cachedb_cassandra wasn't supported with db_cachedb so when I enabled it opensips was seg faulting.  This would probably need to be added to the declaration for other engines.</p>

<p>The cachedb_engine variable <code>cde</code> in <code>mod_init</code> (cachedb_cassandra.c:100) doesn't explicitly set the translation functions of the stack variable to NULL so the check in <code>db_cachedb_query</code> (db_cachedb/dbase.c:132) is passed and the db_query_trans tries to execute which faults:</p>

<h2>Before</h2>

<pre><code>Breakpoint 1, db_cachedb_query (_h=0x7ffff74221a8, _k=0x7fffffffe140, _op=0x0, 
    _v=0x7fffffffe1a0, _c=0x7fffffffe150, _n=1, _nc=1, _o=0x0, 
    _r=0x7fffffffe160) at dbase.c:129
warning: Source file is more recent than executable.
129 {
(gdb) n
130     struct db_cachedb_con* ptr = (struct db_cachedb_con *)_h-&gt;tail;
(gdb) n
132     if (ptr-&gt;cdbf.db_query_trans == NULL) {
(gdb) n
137     return ptr-&gt;cdbf.db_query_trans(ptr-&gt;cdbc,_h-&gt;table,_k,_op,_v,_c,_n,_nc,_o,_r);
(gdb) print *ptr-&gt;cdbf.db_query_trans
$1 = {int (cachedb_con *, const str *, const db_key_t *, const db_op_t *, 
    const db_val_t *, const db_key_t *, const int, const int, const db_key_t, 
    db_res_t **)} 0x7ffff7420aa8
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7420aa8 in ?? ()
</code></pre>

<h2>After</h2>

<pre><code>Breakpoint 1, db_cachedb_query (_h=0x7ffff74221a8, _k=0x7fffffffe140, _op=0x0, 
    _v=0x7fffffffe1a0, _c=0x7fffffffe150, _n=1, _nc=1, _o=0x0, 
    _r=0x7fffffffe160) at dbase.c:129
warning: Source file is more recent than executable.
129 {
(gdb) n
130     struct db_cachedb_con* ptr = (struct db_cachedb_con *)_h-&gt;tail;
(gdb) n
132     if (ptr-&gt;cdbf.db_query_trans == NULL) {
(gdb) n
133         LM_ERR("The selected NoSQL driver cannot convert select queries\n");
(gdb) n
134         return -1;
</code></pre>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href='https://github.com/OpenSIPS/opensips/pull/507'>https://github.com/OpenSIPS/opensips/pull/507</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>set local variable memory to 0 to prevent core dump</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/OpenSIPS/opensips/pull/507/files#diff-0">modules/cachedb_cassandra/cachedb_cassandra.c</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/OpenSIPS/opensips/pull/507.patch'>https://github.com/OpenSIPS/opensips/pull/507.patch</a></li>
  <li><a href='https://github.com/OpenSIPS/opensips/pull/507.diff'>https://github.com/OpenSIPS/opensips/pull/507.diff</a></li>
</ul>

<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/pull/507">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciZuSXPvv376layhYtOHxpOpGOQU9ks5oIjwhgaJpZM4EYNUS.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/pull/507"></link>
    <meta itemprop="name" content="View Pull Request"></meta>
  </div>
  <meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>