-
Notifications
You must be signed in to change notification settings - Fork 633
Closed
Description
Hi Bogdan,
Almost a month ago, I have raised the issue regarding the opensips log file filling up with the following message
ERROR:core:io_watch_del: BUG - trying to del fd 38 with flags 2 1
Now I can reproduce it every time with the following scenario:
-
UAC and UAS are connected to opensips proxy with TCP transport -
Connections looks good -
Netstat shows the connection to UAC in ESTABLISHED state and the tcp_conn_lists of opensips also looks fine for that UAC -
Now unplug the Ethernet cable on UAC -
After tcp connection timeout (set to 5 mins in opensips.cfg), the tcp connection goes away from netstat as well as from tcp_conn_lists -
UAS tries another tcp call to the UAC which is still unplugged -
tcp_conn_lists shows the tcp connection to the UAC and netstat shows the connection in SYN_SENT state -
After the tcp connection timeout (set to 5 mins in opensips.cfg), the connection goes away from netstat however it remains there in tcp_conn_lists and at that moment the “BUG - trying to del fd 38 with flags 2 1” starts printing in infinite loop.
I looked at the source code and observed the following
-
When the network cable is plugged in
The io_watch_add happens with flag IO_WATCH_READ in tcp_main.c when the command is CONN_NEW
2) When the network cable is unplugged
The io_watch_add happens with flag IO_WATCH_WRITE in tcp_main.c when the command is ASYNC_CONNECT
-
While doing io_watch_del after timeout, from handle_tcpconn_ev method, io_watch_del always uses IO_WATCH_READ to delete the fd, which gives this error in case of unplugged cable.
Please look into this and suggest how can I fix this issue ?
Thanks
Rahul Gupta