freeswitch
freeswitch copied to clipboard
websocket fd leak when webpage closed during network break
Describe the bug Using nginx for forward wss port 443 to freeswitch websocket local-IP port 5066, when the client network disconnected and connected quickly, but the web page using sip.js closed during this time. When the network is ok again, the nginx will try reset the websocket connection to freeswitch, but lead to fd leak issue. using lsof , the "protocol: TCP" fd will remains always. freeswitc 91 root 96u sock 0,7 0t0 157747872 protocol: TCP freeswitc 91 root 98u sock 0,7 0t0 161907744 protocol: TCP
To Reproduce Steps to reproduce the behavior:
- Using nginx for forward wss port 443 to freeswitch websocket port 5066,
- Open webpage using sip.js 0.21.2 with transportOptions: {server: sipConfig.wssServer, keepAliveInterval: 20, connectionTimeout: 35}, and SimpleUserOptions.userAgentOptions.contactParams: {transport:"ws"}
- the UA is connected and registed with Via: SIP/2.0/WS
- Shutdown WLAN connection in Windows 10 PC
- Close the webpage of the sip UA
- Reconnect the WLAN connection quicky. (should be less than 15s ,otherwise the bug not happen)
- keep tacking the fd in bash while loop, lsof -p
pidof freeswitch
|grep "protocol: TCP" , the count of fd leak increase by 2
Expected behavior No websocket fd leak
Package version or git hash fs 1.10.9 and fs 1.10.10 using Debian 11.7 kenel 5.10.149-2
attachemt 01 is tcpdump pcap file of the ws part ,from nginx to freeswitch. And 02 for both the wss and ws side.
[fd-leak01.zip](https://github.com/signalwire/freeswitch/files/13581580/fd-leak01.zip)
[fd-leak02.zip](https://github.com/signalwire/freeswitch/files/13582507/fd-leak02.zip)
what sofia-sip library version are you using?
libsofia-sip-ua0 1.13.16-125~dfc7095f4c~bullseye
It is old. You must update libsofia
and libsofia-sip-ua0 1.13.17-128~6198851a61~bullseye
please try using the latest freeswitch master and the latest sofia-sip
I am using the official debian bullseye release oflibfreeswitch1/testing,now 1.10.10~release~24~4cb05e7f4a~bullseye-1~bullseye+1 and libsofia-sip-ua0/testing,now 1.13.17-128~6198851a61~bullseye . Not compiled by source. You mean the latest master branch of fs or sofia-sip may be ok?
Still same issue, Should I push this issue to sofia project?
Is it fixed now? Version 1.8.6 encounters the same problem.
The latest freeswitch master (1.10.10) and the latest sofia-sip(1.13.17) still have this problem
However since the fixes in sofia-sip 1.13.17 it should no longer be necessary to stick nginx in front of freeswitch for this as the problems that solution was to bypass have been fixed.
This problem has been fixed in the latest version, no need to use nginx proxy wss port