<h4 dir="auto">Pre-Submission Checklist</h4>



<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commit message has the format required by CONTRIBUTING guide</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commits are split per component (core, individual modules, libs, utils, ...)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Each component has a single commit (if not, squash them into one commit)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> No commits to README files for modules (changes must be done to docbook files<br>
in <code class="notranslate">doc/</code> subfolder, the README file is autogenerated)</li>
</ul>
<h4 dir="auto">Type Of Change</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Small bug fix (non-breaking change which fixes an issue)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> New feature (non-breaking change which adds new functionality)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Breaking change (fix or feature that would change existing functionality)</li>
</ul>
<h4 dir="auto">Checklist:</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> PR should be backported to stable branches</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Tested changes locally</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Related to issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1339757774" data-permission-text="Title is private" data-url="https://github.com/kamailio/kamailio/issues/3218" data-hovercard-type="issue" data-hovercard-url="/kamailio/kamailio/issues/3218/hovercard" href="https://github.com/kamailio/kamailio/issues/3218">#3218</a></li>
</ul>
<h4 dir="auto">Description</h4>
<p dir="auto">Per the DB issue in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1339757774" data-permission-text="Title is private" data-url="https://github.com/kamailio/kamailio/issues/3218" data-hovercard-type="issue" data-hovercard-url="/kamailio/kamailio/issues/3218/hovercard" href="https://github.com/kamailio/kamailio/issues/3218">#3218</a>:</p>
<p dir="auto">I've determined the commit where dialog with db_mode SHUTDOWN stopped working is <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/kamailio/kamailio/commit/1ff86ffceede46c7a67fec92c8319c34c916a545/hovercard" href="https://github.com/kamailio/kamailio/commit/1ff86ffceede46c7a67fec92c8319c34c916a545"><tt>1ff86ff</tt></a>.</p>
<p dir="auto">This is the change where  <code class="notranslate">PROC_POSTCHILDINIT</code> was enabled/used.</p>
<p dir="auto">In dialog.c <code class="notranslate">child_init()</code>, there is code that resets the DB mode to NONE if not running in the main process:</p>
<div class="highlight highlight-source-c notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   /* in DB_MODE_SHUTDOWN only PROC_MAIN will do a DB dump at the end, so
         * for the rest of the processes will be the same as DB_MODE_NONE */
        if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN)
                dlg_db_mode = DB_MODE_NONE;"><pre>        <span class="pl-c"><span class="pl-c">/*</span> in DB_MODE_SHUTDOWN only PROC_MAIN will do a DB dump at the end, so</span>
<span class="pl-c">      * for the rest of the processes will be the same as DB_MODE_NONE <span class="pl-c">*/</span></span>
        <span class="pl-k">if</span> (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN)
                dlg_db_mode = DB_MODE_NONE;</pre></div>
<p dir="auto">However, because PROC_POSTCHILDINIT has now been enabled for the module, this code effectively disables DB persistence as PROC_POSTCHILDINIT is called in the main process after PROC_MAIN.</p>
<p dir="auto">I have modified the rank check to <code class="notranslate">rank!=PROC_POSTCHILDINIT</code> and can confirm that DB persistence in SHUTDOWN mode is working once again.</p>
<p dir="auto">Note that the PR changes the logic to:</p>
<div class="highlight highlight-source-c notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_POSTCHILDINIT)
                dlg_db_mode = DB_MODE_NONE;"><pre>        <span class="pl-k">if</span> (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_POSTCHILDINIT)
                dlg_db_mode = DB_MODE_NONE;</pre></div>
<p dir="auto">Technically dlg_db_mode will be reset to DB_MODE_NONE when called with rank PROC_MAIN, but the value will be restored when PROC_POSTCHILDINIT is called. I assume this behavior is OK, but otherwise I can change it to:</p>
<div class="highlight highlight-source-c notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN && rank!=PROC_POSTCHILDINIT)
                dlg_db_mode = DB_MODE_NONE;"><pre>        <span class="pl-k">if</span> (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN && rank!=PROC_POSTCHILDINIT)
                dlg_db_mode = DB_MODE_NONE;</pre></div>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/3221'>https://github.com/kamailio/kamailio/pull/3221</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/kamailio/kamailio/pull/3221/commits/5caa9554a518a676e566fb344cc11047310fbb4b" class="commit-link">5caa955</a>  dialog: dont reset dlg_db_mode in POSTCHILDINIT for DB_MODE_SHUTDOWN</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/kamailio/kamailio/pull/3221/files">1 file</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/3221/files#diff-d8b3fcdc2ab936f8c3ede8501220c058ae0e8629da49c92a8278841e1e2e1e8c">src/modules/dialog/dialog.c</a>
    (2)
  </li>
</ul>

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

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/3221">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPYI36MAHAURISBODLVZRL2RANCNFSM56X6PQSQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZIERLQFYPLVJUTWFIDVZRL2RA5CNFSM56X6PQS2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4T7P2QNQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/pull/3221</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/3221",
"url": "https://github.com/kamailio/kamailio/pull/3221",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>