### Description
I bind a wss port on kamailio for connecting to WebRTC clients, when I received a TLS packet on wss port, it will reply a HTML window to browser who sent the packet , as defined in kamailio.cfg:
# xhttp event route event_route[xhttp:request] { ...
If(wss port receives a packet) { xhttp_reply("200", "OK", "text/html","<html><head><meta http-equiv=\"refresh\" content=\"0;url=$shv(URLToBeOpened)\"></head></html>"); }
... }
However , sometimes the HTML window appears stuck in a connecting state, it may be connected or timeout finally.
Above problem happens on ARMv4 , but works smoothly on AArch64. I put some related information in Troubleshooting block, hope these may help to figure out why this happens.
### Troubleshooting
#### Reproduction
Access to https://(IP address of kamailio):(wss port), and stuck in loading page.
<Environment settings>
[ARMv4]
config.mak:
CC=/opt/toolchains/sdk51/gcc/bin/arm-marvell-linux-gnueabi-gcc make cfg include_modules="db_sqlite tls websocket" mode=debug ARCH=armv41 CPUTYPE=cortex-a8 LOCALBASE=/mnt/test/kamailio/
[AArch64]
config.mak:
CC=/opt/toolchains/aarch64-thunderx/bin/aarch64-thunderx-linux-gnu-gcc make cfg include_modules="db_sqlite tls websocket" mode=debug ARCH=aarch64 CPUTYPE=ARMv8 LOCALBASE=/mnt/test/kamailio/
#### Debugging Data
**Note: Not the same time as Log Messsages and SIP Traffic**
[ARMv4] # netstat -apn | grep 10443 tcp 0 0 10.100.92.52:10443 0.0.0.0:* LISTEN 32418/kamailio tcp 518 0 10.100.92.52:10443 10.100.92.29:54693 CLOSE_WAIT 32417/kamailio
Recv-Q on wss port seems stuck here...
[AArch64] # netstat -apn | grep 10443 tcp 0 0 10.100.92.222:10443 0.0.0.0:* LISTEN 9799/kamailio tcp 0 0 10.100.92.222:10443 10.100.92.29:54817 TIME_WAIT - tcp 0 0 10.100.92.222:10443 10.100.92.29:54818 TIME_WAIT - tcp 0 0 10.100.92.222:10443 10.100.92.29:54820 ESTABLISHED 9798/kamailio
#### Log Messages
WSS port used here is 10443, 10.100.92.29 is my PC which uses a WebRTC client to connect to kamailio, 10.100.92.222 is kamailio on AAch64, 10.100.92.52 is kamailio on ARMv4.
[ARMv4] (which stuck in connecting to https://10.100.92.222:10443 ) (no related log was output...)
whole log here: [WSS_TLS_FAIL_10.100.92.52.txt](https://github.com/kamailio/kamailio/files/3106496/WSS_TLS_FAIL_10.100.92.52...)
[AArch64] ... DEBUG: tls [tls_locking.c:110]: locking_f(): lock get (9): 2 (ex_data.c:318) DEBUG: tls [tls_locking.c:116]: locking_f(): lock release (10): 2 (ex_data.c:338) DEBUG: tls [tls_locking.c:110]: locking_f(): lock get (5): 2 (ex_data.c:507) DEBUG: tls [tls_locking.c:116]: locking_f(): lock release (6): 2 (ex_data.c:517) DEBUG: tls [tls_domain.c:736]: sr_ssl_ctx_info_callback(): SSL handshake done DEBUG: tls [tls_domain.c:740]: sr_ssl_ctx_info_callback(): SSL disable renegotiation DEBUG: tls [tls_server.c:415]: tls_accept(): TLS accept successful EBUG: tls [tls_server.c:422]: tls_accept(): tls_accept: new connection from 10.100.92.29:53189 using TLSv1/SSLv3 AES256-SHA 256 DEBUG: tls [tls_server.c:425]: tls_accept(): tls_accept: local socket: 10.100.92.222:10443 DEBUG: tls [tls_server.c:436]: tls_accept(): tls_accept: client did not present a certificate DEBUG: <core> [core/tcp_read.c:1492]: tcp_read_req(): read= 0 bytes, parsed=0, state=0, error=1 DEBUG: <core> [core/tcp_read.c:1495]: tcp_read_req(): last char=0x00, parsed msg= ...
whole log here: [WSS_TLS_OK_10.100.92.222.txt](https://github.com/kamailio/kamailio/files/3106497/WSS_TLS_OK_10.100.92.222....)
#### SIP Traffic
TLS packets captured image
[ARMv4] https://imgur.com/jgnTaLy
[AArch64] https://imgur.com/pfpWSXB
### Possible Solutions
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
[ARMv4]
/mnt/test/kamailio/sbin# ./kamailio -v version: MyLogo , 5.2.2 (armv41/linux) a82930-dirty flags: STATS: Off, EXTRA_DEBUG, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, USE_PTHREAD_MUTEX, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: a82930 -dirty compiled on 15:20:56 Apr 22 2019 with /opt/toolchains/sdk51/gcc/bin/arm-marvell-linux-gnueabi-gcc 4.6.2
[AArch64]
/mnt/test/kamailio/sbin# ./kamailio -v version: MyLogo , 5.2.0-dev3 (aarch64/linux) flags: STATS: Off, EXTRA_DEBUG, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT-NOSMP, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled on 15:47:47 Feb 6 2018 with /opt/toolchains/aarch64-thunderx/bin/aarch64-thunderx-linux-gnu-gcc 5.3.0
* **Operating System**:
[ARMv4] Linux Test 3.2.36-1.00 #1479 SMP Mon Apr 15 10:21:28 CST 2019 armv7l GNU/Linux
[AArch64] Linux Test 4.4.13 #1 SMP PREEMPT Fri Mar 24 10:50:44 CST 2017 aarch64 GNU/Linux
What is the libssl (openssl) version used there?
[ARMv4] 1.0.2r
[AArch64] 1.0.2k
Try to get the output for `kamctl trap` when the process seems to be stuck in order to see what is the execution trace at that moment.
[gdb_kamailio_20190424_125925.txt](https://github.com/kamailio/kamailio/files/3112372/gdb_kamailio_20190424_125...)
Hi, any further assistance needed?
This week many developers were at the KamailioWorld conference - probably therefore nobody could yet view to the traces yet.
The output of `kamctl trap` does not show any blocked process, the sip workers are listening for network traffic. Either you did the trap command when the blocking didn't happen or something else (e.g.firewall) was blocking the traffic.
I noticed that you have children=2/tcp_children=2, so if you have a lot of sip traffic over tcp/tls/wss, set tcp_children to a higher value in order to be able to cope with (e.g., 32).
I let this still open for a bit, in case someone else want to comment or new details are added, otherwise it will be closed.
Closed #1933.