Re: spurious COMM_FAILURE when using fixed ports

Michael Teske via omniORB-list <[email protected]> Fri, 23 Jan 2026 08:40:12 +0100
Newsgroups gmane.comp.corba.omniorb.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============3870950256200740633==
Content-Type: multipart/alternative;
 boundary="------------H0llNOMFWCSEVhJFJs341CNe"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------H0llNOMFWCSEVhJFJs341CNe
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Duncan,


On 1/22/26 11:12, Duncan Grisby wrote:
>
>>   What's left is to find out, what happens in our case where we get
>>>   omniORB: (199) 2026-01-21 10:04:51.861953: Reset rope addresses
>>> (current address giop:tcp:[::1]:53234)
>>>   omniORB: (199) 2026-01-21 10:04:51.861962: Error in network
>>> receive (start of message): giop:tcp:[::1]:53234
>>>   omniORB: (199) 2026-01-21 10:04:51.861966: throw
>>> giopStream::CommFailure from
>>> giopStream.cc:857(0,MAYBE,COMM_FAILURE_WaitingForReply)
> Here, the client does not see a CloseConnection message. It just gets a
> socket error to say the connection has been closed. I'm not sure why it
> did not get the CloseConnection.

As I wrote in the next mail this difference comes from the fact that in our system we use client timeouts everywhere.

In this case waitRead() is used, and if USE_POLL is set, it will return an error and so that the CloseConnection message which

is still in the buffer is not read. It works fine for me with this patch:

--- snip ---

Index: include/omniORB4/internal/tcpSocket.h
===================================================================
--- include/omniORB4/internal/tcpSocket.h    (revision 1135)
+++ include/omniORB4/internal/tcpSocket.h    (working copy)
@@ -362,7 +362,7 @@
      int timeout = t.tv_sec*1000+((t.tv_usec+999)/1000);
      if (timeout == 0) timeout = -1;
      rc = poll(&fds, 1, timeout);
-    if (rc > 0 && fds.revents & POLLERR) {
+    if (rc > 0 && !(fds.revents & POLLIN) && fds.revents & POLLERR) {
        rc = RC_SOCKET_ERROR;
      }
  #else
--- snip ---

poll sets here POLLIN and POLLERR, and in the original code, the CloseConnection is not read.

There's possibly a more correct way to adress this but it would be nice to process any outstanding data before setting the connection to error.


Anyway I would also like to suggest this additional little patch, which would have saved me some time:

--- snip ---

Index: src/lib/omniORB/orbcore/giopServer.cc
===================================================================
--- src/lib/omniORB/orbcore/giopServer.cc    (revision 1135)
+++ src/lib/omniORB/orbcore/giopServer.cc    (working copy)
@@ -451,6 +451,12 @@

    omni_thread::get_time(deadline, timeout);

+  if (omniORB::trace(25)) {
+      omniORB::logger log;
+      log << "server sendCloseConnection: to " << s->connection->peeraddress()
+      << " 12 bytes\n";
+    }
+
    int tx = s->connection->Send(hdr, 12, deadline);
    if (tx <= 0 && omniORB::trace(25)) {
      omniORB::logger log;
--- snip ---

so _all_ CloseConnections are logged. It was a bit confusing to find the message in wireshark but not in the logs.

Greetings,

   Michael








--------------H0llNOMFWCSEVhJFJs341CNe
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Duncan,</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 1/22/26 11:12, Duncan Grisby wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:[email protected]"><br>
      <blockquote type="cite">
        <pre wrap="" class="moz-quote-pre"> What's left is to find out, what happens in our case where we get 
</pre>
        <blockquote type="cite">
          <pre wrap="" class="moz-quote-pre">
 omniORB: (199) 2026-01-21 10:04:51.861953: Reset rope addresses
(current address giop:tcp:[::1]:53234)
 omniORB: (199) 2026-01-21 10:04:51.861962: Error in network
receive (start of message): giop:tcp:[::1]:53234
 omniORB: (199) 2026-01-21 10:04:51.861966: throw
giopStream::CommFailure from
giopStream.cc:857(0,MAYBE,COMM_FAILURE_WaitingForReply)
</pre>
        </blockquote>
      </blockquote>
      <pre wrap="" class="moz-quote-pre">
Here, the client does not see a CloseConnection message. It just gets a
socket error to say the connection has been closed. I'm not sure why it
did not get the CloseConnection.</pre>
    </blockquote>
    <p>As I wrote in the next mail this difference comes from the fact
      that in our system we use client timeouts everywhere.</p>
    <p>In this case waitRead() is used, and if <span
        style="background-color:#ffffff;padding:0px 0px 0px 2px;"><span
style="color:#000000;background-color:#ffffff;font-family:&quot;Monospace&quot;;font-size:11pt;white-space:pre;"><span
        style="color:#b58900;"></span><span style="color:#268bd2;">USE_POLL </span></span></span>is
      set, it will return an error and so that the CloseConnection
      message which</p>
    <p>is still in the buffer is not read. It works fine for me with
      this patch:</p>
    <p>--- snip ---</p>
    <p>Index: include/omniORB4/internal/tcpSocket.h<br>
===================================================================<br>
      --- include/omniORB4/internal/tcpSocket.h    (revision 1135)<br>
      +++ include/omniORB4/internal/tcpSocket.h    (working copy)<br>
      @@ -362,7 +362,7 @@<br>
           int timeout = t.tv_sec*1000+((t.tv_usec+999)/1000);<br>
           if (timeout == 0) timeout = -1;<br>
           rc = poll(&amp;fds, 1, timeout);<br>
      -    if (rc &gt; 0 &amp;&amp; fds.revents &amp; POLLERR) {<br>
      +    if (rc &gt; 0 &amp;&amp; !(fds.revents &amp; POLLIN)
      &amp;&amp; fds.revents &amp; POLLERR) {<br>
             rc = RC_SOCKET_ERROR;<br>
           }<br>
       #else<br>
      --- snip ---</p>
    <p>poll sets here POLLIN and POLLERR, and in the original code, the
      CloseConnection is not read.</p>
    <p>There's possibly a more correct way to adress this but it would
      be nice to process any outstanding data before setting the
      connection to error.</p>
    <p><br>
    </p>
    <p>Anyway I would also like to suggest this additional little patch,
      which would have saved me some time:</p>
    <p>--- snip ---</p>
    <p>Index: src/lib/omniORB/orbcore/giopServer.cc<br>
===================================================================<br>
      --- src/lib/omniORB/orbcore/giopServer.cc    (revision 1135)<br>
      +++ src/lib/omniORB/orbcore/giopServer.cc    (working copy)<br>
      @@ -451,6 +451,12 @@<br>
       <br>
         omni_thread::get_time(deadline, timeout);<br>
       <br>
      +  if (omniORB::trace(25)) {<br>
      +      omniORB::logger log;<br>
      +      log &lt;&lt; "server sendCloseConnection: to " &lt;&lt;
      s-&gt;connection-&gt;peeraddress()<br>
      +      &lt;&lt; " 12 bytes\n";<br>
      +    }<br>
      +  <br>
         int tx = s-&gt;connection-&gt;Send(hdr, 12, deadline);<br>
         if (tx &lt;= 0 &amp;&amp; omniORB::trace(25)) {<br>
           omniORB::logger log;<br>
      --- snip ---</p>
    <p>so _all_ CloseConnections are logged. It was a bit confusing to
      find the message in wireshark but not in the logs.</p>
    <p>Greetings,</p>
    <p>  Michael</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
  </body>
</html>

--------------H0llNOMFWCSEVhJFJs341CNe--


--===============3870950256200740633==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
omniORB-list mailing list
[email protected]
https://www.omniorb-support.com/mailman/listinfo/omniorb-list

--===============3870950256200740633==--