<h3>Description</h3>
<p>IMS reregistration triggers core dump on 5.1.4.</p>
<ol>
<li>Create IMS registration</li>
<li>Put IMS terminal offline</li>
<li>Put it back online to update IMS registration</li>
<li>Register requests time out on s-cscf</li>
</ol>
<h3>Troubleshooting</h3>
<p>This seems to be related to the cleaning up contacts during registration/re-registration. Related to the <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="331639715" data-permission-text="Issue title is private" data-url="https://github.com/kamailio/kamailio/issues/1562" href="https://github.com/kamailio/kamailio/pull/1562">#1562</a>. This PR did not make it to 5.1.4 but affected code was clearly involved according to the logs.</p>
<h4>Reproduction</h4>
<h4>Debugging Data</h4>
<h4>Log Messages</h4>
<pre><code>Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:451]: process_impurecord(): There are 2 contacts to expire/unlink
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:454]: process_impurecord(): expiring contact 0: [sip:XXXYY4000013362@10.110.1
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:1237]: unlink_contact_from_impu(): asked to unlink contact [0x7f7141cf29a0] => [sip:XXXYY4000
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:1106]: remove_impucontact_from_list(): deleting mid list
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [usrloc_db.c:1130]: db_unlink_contact_from_impu(): DB: un-linking contact to IMPU
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: <core> [db_res.c:120]: db_new_result(): allocate 56 bytes for result set at 0x7f714ba6e620
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: <core> [db_res.c:79]: db_free_columns(): freeing 0 columns
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: <core> [db_res.c:138]: db_free_result(): freeing result set at 0x7f714ba6e620
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [usrloc_db.c:1155]: db_unlink_contact_from_impu(): Delete query success
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [udomain.c:852]: unref_contact_unsafe(): decrementing ref count on contact [sip:XXXYY4000013362@10.110.1.69
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [udomain.c:855]: unref_contact_unsafe(): contact [sip:XXXYY4000013362@10.110.1.69:5060;alias=10.110.1.69~50
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:1263]: unlink_contact_from_impu(): unlinking contact [0x7f7141cf29a0] => [sip:XXXYY4000013362
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:454]: process_impurecord(): expiring contact 1: [sip:XXXYY4000013362@10.110.1
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:1237]: unlink_contact_from_impu(): asked to unlink contact [0x7f7141cfc878] => [sip:XXXYY4000
Jul 24 07:21:00 scscf scscfXXXYYY-ecs[798]: 1(6) DEBUG: ims_usrloc_scscf [impurecord.c:1103]: remove_impucontact_from_list(): **deleting tail**
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:840]: update_contacts(): updating contacts in RE-REGISTRATION state
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:519]: update_contacts_helper(): updating the contacts for IMPU <sip:XXXYY4000013362@ims.mnc006.
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: <core> [ims_getters.c:812]: cscf_get_sos_uri_param(): cscf_get_sos_uri_param: searching through the uri parameters:alias=10
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: <core> [ims_getters.c:823]: cscf_get_sos_uri_param(): cscf_get_sos_uri_param:name: alias body: 10.110.1.71~5060~1
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:137]: calc_contact_expires(): Calculated expires for contact is 600000
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:548]: update_contacts_helper(): Need to update contact: <sip:XXXYY4000013362@10.110.1.71:5060;a
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:550]: update_contacts_helper(): packing contact information
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:556]: update_contacts_helper(): adding/updating contact based on prior existence
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_usrloc_scscf [impurecord.c:748]: get_scontact(): looking for contact [sip:XXXYY8000099992@10.110.1.71:5060;alias=10.110
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_registrar_scscf [save.c:562]: update_contacts_helper(): inserting new contact
Jul 24 07:22:21 scscf scscfXXXYYY-ecs[798]: 15(20) DEBUG: ims_usrloc_scscf [impurecord.c:562]: insert_scontact(): INSERTing ucontact in usrloc module
Jul 24 07:22:21 scscf kernel: traps: kamailio[7186] general protection ip:7f7146511000 sp:7ffc9f3719a0 error:0 in ims_usrloc_scscf.so[7f71464e7000+8f000]
</code></pre>
<h4>SIP Traffic</h4>
<p><a target="_blank" href="https://user-images.githubusercontent.com/1636682/43138556-8dc89988-8f4f-11e8-887a-53c4fb7805e1.png"><img src="https://user-images.githubusercontent.com/1636682/43138556-8dc89988-8f4f-11e8-887a-53c4fb7805e1.png" alt="image" style="max-width:100%;"></a></p>
<pre><code>(paste your sip traffic here)
</code></pre>
<h3>Possible Solutions</h3>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>version: kamailio 5.1.4 (x86_64/linux)
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<pre><code>Linux scscf 4.14.48-coreos-r2 #1 SMP Thu Jun 14 08:23:03 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1600">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZcD02hIMcUoeCl7BC3DiVYHFvsdRks5uJxdBgaJpZM4VcrFO">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZSfovy9VdOLK1Y7L7p_738Och2zDks5uJxdBgaJpZM4VcrFO.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"crash in ims_usrloc_scscf.so (#1600)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1600"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1600",
"url": "https://github.com/kamailio/kamailio/issues/1600",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "crash in ims_usrloc_scscf.so (#1600)",
"sections": [
{
"text": "",
"activityTitle": "**Sergey Zyrianov**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@szcom",
"facts": [
{
"name": "Repository: ",
"value": "kamailio/kamailio"
},
{
"name": "Issue #: ",
"value": 1600
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1600,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1600\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1600"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 359838030\n}"
}
],
"themeColor": "26292E"
}
]</script>