<p>Hi Bogdan, I will generate the core file and upload the logs and core soon. </p>

<p>Meanwhile, I have put the following fix which seems working and I haven't experienced any issues so far. Could you please review it and let me know if there is any potential problem</p>

<p>Added the following condition in tcp_main.c where its calling io_watch_del in the particular failure scenario inside the method handle_tcpconn_ev() </p>

<p>if(tcpconn-&gt;flags &amp; F_CONN_NOT_CONNECTED)<br>
{<br>
                       if (io_watch_del(&amp;io_h, tcpconn-&gt;s, fd_i, 0,IO_WATCH_WRITE)==-1)<br>
                               return -1; <br>
}</p>

<p>This F_CONN_NOT_CONNECTED flag is only added in case of ASYNC_CONNECT where the connection is being added with IO_WATCH_WRITE mode.</p>

<p>The difference between file code is:</p>

<p>[root@rg-rhel-65 opensips-1.11.5-tls]# diff tcp_main.c.orig tcp_main.c<br>
1565,1566c1565,1575<br>
&lt;               if (io_watch_del(&amp;io_h, tcpconn-&gt;s, fd_i, 0,IO_WATCH_READ)==-1)</p>

<h2>&lt;                       return -1;</h2>

<blockquote>
<pre><code>          if(tcpconn-&gt;flags &amp; F_CONN_NOT_CONNECTED)
          {
                  if (io_watch_del(&amp;io_h, tcpconn-&gt;s, fd_i, 0,IO_WATCH_WRITE)==-1)
                          return -1;
          }
          else
          {
                  if (io_watch_del(&amp;io_h, tcpconn-&gt;s, fd_i, 0,IO_WATCH_READ)==-1)
                          return -1;
          }
</code></pre>
</blockquote>

<p>Thanks<br>
Rahul</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/591#issuecomment-129476952">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciccO8xoqJNCcXYVZorekw6qAQ2qOks5omK7IgaJpZM4FnHG4.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/591#issuecomment-129476952"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>