Skip to content

error in infinite loop "io_watch_del: BUG - trying to del fd 34 with flags 2 1" #591

@rgupta0110

Description

@rgupta0110

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:

  1.  UAC and UAS are connected to opensips proxy with TCP transport
    
  2.  Connections looks good
    
  3.  Netstat shows the connection to UAC in ESTABLISHED state and the tcp_conn_lists of opensips also looks fine for that UAC
    
  4.  Now unplug the Ethernet cable on UAC
    
  5.  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
    
  6.  UAS tries another tcp call to the UAC which is still unplugged
    
  7.  tcp_conn_lists shows the tcp connection to the UAC and netstat shows the connection in SYN_SENT state
    
  8.  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

  1.  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

  1.  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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions