[omniORB] Bug in tcpConnection::Recv and Send functions

Serguei Kolos serguei.kolos at cern.ch
Sat May 9 16:15:32 UTC 2020


Hello

I have found a bug in the TCP layer of omniORB 4.2.3 but I'm not sure 
what's the best way of fixing it.
The issue appears under the following conditions:

  * I start my CORBA server application
  * I start me CORBA client that make a call to the server
  * I kill the server
  * I stop the client with Ctrl-C (that is important!). In this case
    when the client tries to make another call to the server it hangs
    until the omniORB timeout expires.

The problem occurs because Ctrl-C signal sets the *errno* variable to 
*EINTR*, which masks the socket error
due to the following code in the tcpSocket::waitRead() function:

    if (rc > 0 && fds.revents & POLLERR) {
       rc = RC_SOCKET_ERROR;
    }

This function returns RC_SOCKET_ERROR and the tcpConnection::Recv enters 
into a crazy loop until
the timeout occurs because of the following code:

    tx = tcpSocket::waitRead(pd_socket, t);
    ...
    if (*tx == RC_SOCKET_ERROR*) {
        if (*ERRNO == RC_EINTR*) {
    *continue*;
        }
        else {
           return -1;
        }
    }

The same issue is present in the tcpConnection::Send function.
As a workaround I have added a line that sets ERRNO to zero if POLLERR 
event is detected, but I'm wondering
if that could have undesired consequences in other situations.

     if (rc > 0 && fds.revents & POLLERR) {
       rc = RC_SOCKET_ERROR;
       ERRNO = 0;
     }

I would appreciate if someone suggests a proper fix for the issue.

Cheers,
Serguei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20200509/8bf78088/attachment.html>


More information about the omniORB-list mailing list