SUMMARY: ypbind timeout

From: Mark Mann (mann@emma.la.asu.edu)
Date: Thu Jan 14 1993 - 04:31:39 CST


My original problem concerned the less than adequate response of ypbind
to a NIS-server going down. There were three solutions given in the
replies I received:

        1) Apply patch 100342-03.

                This patch alters the behavior of ypbind. From the
                patch itself:

                This is a new version of ypbind that never uses the NIS
                binding file to cache the servers binding. This will have
                the effect of fixing the current symptom. However, it might
                degrade the overall performance of the system when the
                server is unavailable.

        2) Patch clnt_udp.c

                There is another version of ypbind available which is
                supposed to address just this problem. A description
                of this fix is at the end of this message. Unfortunately,
                after I installed this fix, my machine would not boot.
                It hung as soon as NIS tried to start up. I didn't spend
                a lot of time trying to debug this problem, it may yet
                work (for me) in the future.

        3) Use ypbind -ypset{me}

                This will not work. Since the machine is virtually
                hung (running programs keep on running, new programs
                hang), you cannot run the ypset program.

I chose to use solution #1, since it was the only one that worked for me.
It has improved the response of ypbind dramatically. The patch mentions
that "it might degrade the overall performance of the system when the
server is unavailable". I find this a reasonable tradeoff, considering
the machine is practically unusable without this patch when a server
goes down :)

The many thanks go to:
  aahvdl@eye.psych.umn.edu
  age!glenn@fourx.Aus.Sun.Com
  chison.Portland@xerox.com
  chris@invmms.worldbank.or
  dla@se05.wg2.waii.com
  feldt@phyast.nhn.uoknor.e
  fmc@key.amdahl.com
  jeff@millie.loc.gov
  r!edsdrd!srr@uunet.UU.NET
  rwh@lightnet.com
  steve@seattle.Avcom.COM
  trdlnk!mike@uunet.UU.NET

Mark Mann Mars Observer Thermal Emission Spectrometer Project
(602) 965-0106 Mark.Mann@tes.la.asu.edu

--- ypbind fix mentioned in solution #2 ---

I believe this fix was created by Casper H.S. Dik (casper@fwi.uva.nl)

        - obtain clnt_udp.c from SUNRPC 4.0
          SUNRPC 4.0 is available at numerous FTP sites, e.g.,
          ftp.uu.net:/systems/sun/sextape/rpc4.0/rpc/clnt_udp.c.Z

        - apply the context diff at the end of this messages.
          
        - compile:
                cc -O4 -c -pic clnt_udp.c
          install the obtained clnt_udp.o in the shared library.

          See /usr/lib/shlib.etc/README for details. If you run SunOS 4.1.2,
          you must change the following in shlib.etc/Makefile (twice):

           ld -assert pure-text `${OBJSORT} lorder-sparc tmp`
          to
           ld -assert pure-text `${OBJSORT} lorder-sparc tmp` -ldl

         - test the new shared library.
           % setenv LD_LIBRARY_PATH <where the library is>
           % ldd /usr/etc/rpcinfo
                -lc.1 => <the new library>
                -ldl.1 => ... (with SunOS 4.1.2)
           % /usr/etc/rpcinfo -u <host> ypserv
           if <host> is unreachable, or if host does not run the portmapper
           the (immediate) response should be:

           rpcinfo: RPC: Port mapper failure - RPC: Unable to receive
           program 100004 is not available

*** clnt_udp.c.orig Thu Mar 14 12:52:12 1991
--- clnt_udp.c Fri Jan 17 17:55:39 1992
***************
*** 27,32 ****
--- 27,37 ----
   * 2550 Garcia Avenue
   * Mountain View, California 94043
   */
+ /*
+ * Casper Dik (casper@fwi.uva.nl)
+ * changed sendto in clntudp_call to connect/send.
+ * This enables the caller to receive ICMP messages as Host or port unreachable
+ */
  #if !defined(lint) && defined(SCCSIDS)
  static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
  #endif
***************
*** 256,265 ****
                  return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
          outlen = (int)XDR_GETPOS(xdrs);
  
  send_again:
! if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0,
! (struct sockaddr *)&(cu->cu_raddr), cu->cu_rlen)
! != outlen) {
                  cu->cu_error.re_errno = errno;
                  return (cu->cu_error.re_status = RPC_CANTSEND);
          }
--- 261,280 ----
                  return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
          outlen = (int)XDR_GETPOS(xdrs);
  
+ /*
+ * Give error (ECONNREFUSED/EHOSTUNREACH) instead of timeout.
+ * Gives much faster NIS rebinding.
+ * Errors are not detected here, but in the recvfrom()
+ * following the select().
+ */
+ if (connect(cu->cu_sock, (struct sockaddr *)(&cu->cu_raddr),
+ cu->cu_rlen) != 0) {
+ cu->cu_error.re_errno = errno;
+ return (cu->cu_error.re_status = RPC_CANTSEND);
+ }
+
  send_again:
! if (send(cu->cu_sock, cu->cu_outbuf, outlen, 0) != outlen) {
                  cu->cu_error.re_errno = errno;
                  return (cu->cu_error.re_status = RPC_CANTSEND);
          }



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:07:22 CDT