<h3>Description</h3>
<p>On our setup with Kamailio 5.2.1 with users connected via TLS. i see frequently TCP/TLS sessions remain in CLOSE_WAIT:</p>
<p>netstat -ntp |grep CLOSE<br>
tcp      238      0 172.17.217.10:5061      xxx.xxx.xxx.218:52613     CLOSE_WAIT  117912/kamailio<br>
tcp     4681      0 172.17.217.10:5061      xxx.xxx.xxx.125:8892     CLOSE_WAIT  117912/kamailio</p>
<p>In tcpdump i see, that the client send a TCP FIN,ACK and and the OS which is hosting the Kamailio send TCP ACK. But Kamailio is not closing. So the session remain in CLOSE_WAIT for a long time (over a hour)</p>
<p>We also have configured:</p>
<p>tcp_connection_lifetime=65<br>
modparam("tls", "connection_timeout", 63)</p>
<p>Which should finally close after 65 second. But no effect.</p>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>Register SIP clients via TLS, and then let the client close the TCP session ia TCP FIN,ACK</p>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<p>Debian GNU/Linux 9</p>

<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/1881">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36Zc_lsa6o2Lg5G4OXuYrtVANCOd70ks5vTkOegaJpZM4bePkf">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZUlADYNX7Mq9zcDJnGGYrH_YE0MJks5vTkOegaJpZM4bePkf.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://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Frequently TCP/TLS sessions remain in CLOSE_WAIT  (#1881)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1881"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1881",
"url": "https://github.com/kamailio/kamailio/issues/1881",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>