Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: <core> [core/mem/q_malloc.c:291]: qm_find_free(): qm_find_free(0x7f8b8cdcd000, 65728); Free fragment not found!
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: <core> [core/mem/q_malloc.c:425]: qm_malloc(): qm_malloc(0x7f8b8cdcd000, 65728) called from websocket: ws_conn.c: wsconn_add(197), module: websocket; Free fragment not found!

Can you try increasing the memory?

On Tue, 19 Nov 2019 at 02:22, Tom D <dworakowski.tom@gmail.com> wrote:
As a supplement to the above:

Kamailio is launched with -m 64 -M 4. 
After researching, I've doubled the values and we'll see shortly.

kamctl stats shmem
{
  "jsonrpc":  "2.0",
  "result": [
    "shmem:fragments = 11935",
    "shmem:free_size = 36995032",
    "shmem:max_used_size = 66744520",
    "shmem:real_used_size = 30113832",
    "shmem:total_size = 67108864",
    "shmem:used_size = 20683936"
  ],
  "id": 30547
}

kamcmd pkg.stats returns
{
        entry: 0
        pid: 14908
        rank: 0
        used: 1684296
        free: 1567448
        real_used: 2626856
        total_size: 4194304
        total_frags: 1974
}
{
        entry: 1
        pid: 14909
        rank: 1
        used: 1776064
        free: 1285152
        real_used: 2909152
        total_size: 4194304
        total_frags: 2283
}
{
        entry: 2
        pid: 14910
        rank: 2
        used: 1776608
        free: 1397344
        real_used: 2796960
        total_size: 4194304
        total_frags: 1200
}
{
        entry: 3
        pid: 14911
        rank: 3
        used: 1776504
        free: 1398488
        real_used: 2795816
        total_size: 4194304
        total_frags: 1190
}
{
        entry: 4
        pid: 14912
        rank: 4
        used: 1776616
        free: 1397440
        real_used: 2796864
        total_size: 4194304
        total_frags: 1199
}
{
        entry: 5
        pid: 14913
        rank: 5
        used: 1776696
        free: 1395072
        real_used: 2799232
        total_size: 4194304
        total_frags: 1226
}
{
        entry: 6
        pid: 14914
        rank: 6
        used: 1776808
        free: 1399120
        real_used: 2795184
        total_size: 4194304
        total_frags: 1186
}
{
        entry: 7
        pid: 14915
        rank: 7
        used: 1776800
        free: 1399544
        real_used: 2794760
        total_size: 4194304
        total_frags: 1182
}
{
        entry: 8
        pid: 14916
        rank: 8
        used: 1776808
        free: 1399536
        real_used: 2794768
        total_size: 4194304
        total_frags: 1182
}
{
        entry: 9
        pid: 14917
        rank: -1
        used: 1775848
        free: 1416200
        real_used: 2778104
        total_size: 4194304
        total_frags: 1045
}
{
        entry: 10
        pid: 14918
        rank: -1
        used: 1775848
        free: 1416200
        real_used: 2778104
        total_size: 4194304
        total_frags: 1045
}
{
        entry: 11
        pid: 14919
        rank: -1
        used: 1775848
        free: 1416928
        real_used: 2777376
        total_size: 4194304
        total_frags: 1038
}
{
        entry: 12
        pid: 14920
        rank: -2
        used: 1775848
        free: 1416928
        real_used: 2777376
        total_size: 4194304
        total_frags: 1038
}
{
        entry: 13
        pid: 14921
        rank: -2
        used: 1841304
        free: 1351368
        real_used: 2842936
        total_size: 4194304
        total_frags: 1038
}
{
        entry: 14
        pid: 14922
        rank: -2
        used: 1786392
        free: 1405864
        real_used: 2788440
        total_size: 4194304
        total_frags: 1032
}
{
        entry: 15
        pid: 14923
        rank: -1
        used: 1778072
        free: 1414392
        real_used: 2779912
        total_size: 4194304
        total_frags: 1032
}
{
        entry: 16
        pid: 14924
        rank: -1
        used: 1778072
        free: 1414392
        real_used: 2779912
        total_size: 4194304
        total_frags: 1032
}
{
        entry: 17
        pid: 14925
        rank: -1
        used: 1778072
        free: 1414392
        real_used: 2779912
        total_size: 4194304
        total_frags: 1032
}
{
        entry: 18
        pid: 14926
        rank: -1
        used: 1778464
        free: 1413896
        real_used: 2780408
        total_size: 4194304
        total_frags: 1031
}
{
        entry: 19
        pid: 14927
        rank: -1
        used: 1778072
        free: 1414392
        real_used: 2779912
        total_size: 4194304
        total_frags: 1032
}
{
        entry: 20
        pid: 14928
        rank: 9
        used: 1858696
        free: 1331272
        real_used: 2863032
        total_size: 4194304
        total_frags: 1035
}
{
        entry: 21
        pid: 14929
        rank: 10
        used: 1858552
        free: 1331520
        real_used: 2862784
        total_size: 4194304
        total_frags: 1034
}
{
        entry: 22
        pid: 14930
        rank: 11
        used: 1858672
        free: 1331504
        real_used: 2862800
        total_size: 4194304
        total_frags: 1033
}
{
        entry: 23
        pid: 14933
        rank: 12
        used: 1858552
        free: 1331416
        real_used: 2862888
        total_size: 4194304
        total_frags: 1035
}
{
        entry: 24
        pid: 14934
        rank: -4
        used: 1765848
        free: 1485584
        real_used: 2708720
        total_size: 4194304
        total_frags: 1974

}

---------- Forwarded message ---------
From: Tom D <dworakowski.tom@gmail.com>
Date: Mon, Nov 18, 2019 at 7:59 PM
Subject: Websocket immediately disconnecting
To: <sr-users@lists.kamailio.org>


Hi David,

Thanks for your reply.

After increasing the verbosity of the debugging, I found the following entries. So am I understanding the log correctly: the websocket module is trying to get some free memory (from Kamilio's general pool?). It doesn't receive any yet proceeds with parsing the response (I get this same parsing error even when it's working) and ultimately, it doesn't register the websocket?

I appreciate your (or anyone's) thoughts.

Regards, Tom

Nov 19 02:44:44 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: tls [tls_domain.c:737]: sr_ssl_ctx_info_callback(): SSL handshake started
Nov 19 02:44:44 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: tls [tls_domain.c:749]: sr_ssl_ctx_info_callback(): SSL handshake done
Nov 19 02:44:44 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: tls [tls_domain.c:753]: sr_ssl_ctx_info_callback(): SSL disable renegotiation
Nov 19 02:44:44 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: tls [tls_server.c:431]: tls_accept(): tls_accept: new connection from HI.DD.E.N:63356 using TLSv1/SSLv3 AES256-GCM-SHA384 256
Nov 19 02:44:44 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: tls [tls_server.c:434]: tls_accept(): tls_accept: local socket: HI.DD.E.N:8089
Nov 19 02:44:44 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: tls [tls_server.c:445]: tls_accept(): tls_accept: client did not present a certificate
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: CRITICAL: <script>: 857:HTTP Request Received
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: <core> [core/mem/q_malloc.c:291]: qm_find_free(): qm_find_free(0x7f8b8cdcd000, 65728); Free fragment not found!
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: <core> [core/mem/q_malloc.c:425]: qm_malloc(): qm_malloc(0x7f8b8cdcd000, 65728) called from websocket: ws_conn.c: wsconn_add(197), module: websocket; Free fragment not found!
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: websocket [ws_conn.c:199]: wsconn_add(): allocating shared memory
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: <core> [core/parser/parse_fline.c:262]: parse_first_line(): parse_first_line: bad message (offset: 22)
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: <core> [core/parser/msg_parser.c:681]: parse_msg(): ERROR: parse_msg: message=<HTTP/1.1 101 Switching Protocols#015#012Sia: SIP/2.0/TLS HI.DD.E.N:63356#015#012Access-Control-Allow-Origin: https://www.doubango.org#015#012Sec-WebSocket-Protocol: sip#015#012Upgrade: websocket#015#012Connection: upgrade#015#012Sec-WebSocket-Accept: taS0s3Z7t4tOhklSbJDLGmSSYsY=#015#012Server: kamailio (5.2.5 (x86_64/linux))#015#012Content-Length: 0#015#012#015#012>
Nov 19 02:44:45 MY-HOSTNAME /usr/sbin/kamailio[14928]: ERROR: websocket [ws_frame.c:583]: ws_frame_receive(): WebSocket connection not found
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users