[comp.sys.isis] HPUX sendto workaround

tclark@honir.cs.cornell.edu (Timothy Clark) (08/24/90)

Due to several reports of ISIS running slowly on nets with HPUX 7.0 machines,
we have discovered what appears to be a bug in the HPUX implementation of the
sendto primitive for UDP sockets.  We are working with HP on the problem, and
in the meantime we have come up with a rather interesting workaround.

The problem occurs when the following conditions are met:
- The process issuing the sendto command is running on an HPUX 7.0 machine; 
- the destination machines are of mixed architectures, i.e SUN3s, sparcstations
  DECstations, HPs, etc..

The problem does not arise if the SUN or MIPS machine does the sending, or if
the communication is done entirely between HP systems.

The workaround:
Initially we discovered that the default SO_BURST_OUT value for a socket with 
the HPUX 7.0 implementation is 2, which means only 2 messages may be queued 
for transmission before the sendto() function will block.  Once the channel is
congested, it takes about 3 seconds to clear.  When we modified this value to
7 (the maximum within ISIS), the call blocked much later and much less often -
but still blocked eventually.  Performance improved about 50 per cent.  This 
part of the workaround is presently included in the distribution version of 
ISIS.

Since this didn't really solve the problem, we had another idea ... why not
try closing and reopening the congested socket!  So we open the UDP sockets in
non-blocking mode and when we issue the sendto command, we check for an error
return code and an EWOULDBLOCK errno.  If so, the socket is congested and we 
close it, reopen it and reset the SO_BURST_OUT value.  

**NOTE** Don't worry ... All this code is within #ifdef HPUX bracketing!!

Believe it or not, this eliminates the 3 second delays and brings the HP 
performance almost in line with the SUN/DEC machines.

By the way, ISIS is tolerant of any messages lost (discarded) when the socket 
is closed, and they will be re-transmitted.  This *workaround* needs a little
more final testing, but will be included in the distribution version of ISIS
by the end of today or tomorrow.

--Tim