[omniORB] EAGAIN

Rick H. Wesson wessorh@ar.com
Wed, 17 Jun 1998 10:15:54 -0700 (PDT)


atached is a partial truss of "nameclt list"
if the change had not been made the client would have shut down the
socket and thrwn a CORBA::COM_FAILURE because the errorcode would not
have been 0, adding the code for EAGAIN, allows the socket to be
re-checked for some data, i doubt it is that effeciant but it makes
the code runnable.

-rick

sigprocmask(SIG_UNBLOCK, 0xEF546BB8, 0x00000000) = 0
brk(0x000E1568)                                 = 0
brk(0x000E3568)                                 = 0
brk(0x000E3568)                                 = 0
brk(0x000E5568)                                 = 0
so_socket(2, 2, 0, "", 1)                       = 5
fstat64(5, 0xEFFFE698)                          = 0
getsockopt(5, 65535, 8192, 0xEFFFE79C, 0xEFFFE798) = 0
setsockopt(5, 65535, 8192, 0xEFFFE79C, 4)       = 0
fcntl(5, F_SETFL, 0x00000080)                   = 0
connect(5, 0xEFFFE8C0, 16)                      = 0
send(5, " G I O P01\0\003\0\0\014".., 32, 0)    = 32
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, " G I O P01\0\004\0\0\0\b".., 8200, 0)  = 20
send(5, " G I O P01\0\0\0\0\0\0 8".., 68, 0)    = 68
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, " G I O P01\0\001\0\0\08C".., 8200, 0)  = 152
(write(2, " (", 1)                              = 1
foowrite(2, " f o o", 3)                                = 3
,write(2, " ,", 1)                              = 1
barwrite(2, " b a r", 3)                                = 3
) binding type write(2, " )   b i n d i n g   t y".., 15)       = 15
ncontextwrite(2, " n c o n t e x t", 8)                 = 8

write(2, "\n", 1)                               = 1
send(5, " G I O P01\0\003\0\0\014".., 32, 0)    = 32
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, " G I O P01\0\004\0\0\0\b".., 8200, 0)  = 20
send(5, " G I O P01\0\0\0\0\0\0 8".., 68, 0)    = 68
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, 0x000E32B8, 8200, 0)                    Err#11 EAGAIN
recv(5, " G I O P01\0\001\0\0\014".., 8200, 0)  = 32
send(5, " G I O P01\0\0\0\0\0\0 3".., 63, 0)    = 63
recv(5, " G I O P01\0\001\0\0\0\f".., 8200, 0)  = 24
llseek(0, 0, SEEK_CUR)                          = 962942
_exit(0)

On Wed, 17 Jun 1998, Sai-Lai Lo wrote:

> >>>>> Rick H Wesson writes:
> 
> > i had to patch lib/omniORB2/tcpSocketMTfactory.cc at line 656 
> > from
> >       if (errno == EINTR)
> > to
> >       if (errno == EINTR || errno == EAGAIN)
> 
> > for the clients to work properly in snapshot_980410, cliients were
> > throwing COMM_FAILURE because ::recv would return EAGAIN, meaning
> > there was nothing to read on the socket, when omnoORB thought
> > there was something.
> 
> > this only relates to Solaris 2.6 on sparc. now all the tests and
> > applications run fine. 
> 
> 
> Thanks for the report.
> 
> Could you describe what is the problem you are having before you apply the
> patch?
> 
> It is not obvious to me why recv would ever return -1 with EAGAIN because
> the socket is not set to non-blocking.
> 
> OK, on solaris, the socket was set to non-blocking before connect(2) is
> called. But once the connection succeed, the socket is set back to
> blocking. So the problem you are having may be related to the fcntl(2)
> calls that change the blocking behaviour of the socket.
> 
> Could you verify this by undoing your patch and remove the code-block in 
> tcpSocketMTfactory.cc: realConnect() that change the blocking behaviour in
> connect(2)? 
> 
> Regards,
> 
> Sai-Lai
> 
> -- 
> Dr. Sai-Lai Lo                          |       Research Scientist
>                                         |
> E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
>                                         |       24a Trumpington Street
> Tel:            +44 223 343000          |       Cambridge CB2 1QA
> Fax:            +44 223 313542          |       ENGLAND
>