<p></p>
<h3 dir="auto">Description</h3>
<p dir="auto">By using the WebSocket module we noticed that the memory on the server keeps increasing daily even if the number of registered devices is decreasing</p>
<h3 dir="auto">Troubleshooting</h3>
<h4 dir="auto">Reproduction</h4>
<p dir="auto">Connect to the server through the wss and then disable the network adapter.</p>
<h4 dir="auto">Debugging Data</h4>
<p dir="auto">If the TCP connection is closed forcefully (tested by disabling network adapter) then the number of current wss connections is not decreasing:</p>
<pre class="notranslate"><code class="notranslate">kamcmd stats.get_statistics all | grep "ws_current_connections"
</code></pre>
<p dir="auto">The same happens with the allocated shared memory:</p>
<pre class="notranslate"><code class="notranslate">kamcmd mod.stats all shm | grep 'wsconn_'
</code></pre>
<p dir="auto">wsconn_add(198) - this value is not decreasing.<br>
Everything is working properly if the TCP connection is properly closed.</p>
<ul dir="auto">
<li><strong>Operating System</strong>:</li>
</ul>
<pre class="notranslate"><code class="notranslate">CentOS 7 X64
3.10.0-1160.76.1.el7.x86_64
version: kamailio 5.6.1 (x86_64/linux) d8f98b
</code></pre>
<p dir="auto">XHTTP Request Route:</p>
<pre class="notranslate"><code class="notranslate">event_route[xhttp:request] {
  set_reply_close();
  set_reply_no_connect();

   if (ws_handle_handshake()) {
    xlog("L_INFO", "[$cfg(route)] websocket|log|handled HTTP request $rm from $si:$sp\n");
    exit;
  }
}
</code></pre>
<p dir="auto">TCP Settings:</p>
<pre class="notranslate"><code class="notranslate">tcp_connection_lifetime=3605
tcp_accept_no_cl=yes
tcp_rd_buf_size=16384
tcp_connect_timeout=10
tcp_crlf_ping=yes
tcp_delayed_ack = yes
tcp_fd_cache = yes
tcp_keepalive = yes
tcp_keepcnt = 3
tcp_keepidle = 30
tcp_keepintvl = 10
tcp_accept_aliases=no
tcp_async=yes
tcp_linger2=30
tcp_max_connections=4096
tcp_send_timeout = 10
</code></pre>

<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/issues/3236">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZPRE5GNWASHBECISR3V6HM2JANCNFSM6AAAAAAQMOZZXQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZLVHEA5WCE5UDPXF23V6HM2JA5CNFSM6AAAAAAQMOZZXSWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHFDV2L6A.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/issues/3236</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/issues/3236",
"url": "https://github.com/kamailio/kamailio/issues/3236",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>