Subject: lib/3117: YP doesn't let RPC do any retransmissions
To: None <gnats-bugs@gnats.netbsd.org>
From: None <Michael.Eriksson@era-t.ericsson.se>
List: netbsd-bugs
Date: 01/17/1997 12:05:02
>Number:         3117
>Category:       lib
>Synopsis:       YP doesn't let RPC do any retransmissions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 17 03:20:00 1997
>Last-Modified:
>Originator:     Michael Eriksson
>Organization:
Ericsson Radio Systems AB
>Release:        1.2
>Environment:
NetBSD 1.2 (and -current)
>Description:

YP sets the resend interval to the same value as the total RPC
timeout, which means that it won't let RPC do any retries before doing
a rebind. In NetBSD 1.1 the retry interval was half the total timeout,
i.e., RPC was allowed to do one retransmission. This is desirable, as
the most common reason for a time out (at least on the network where
my machine is :-)) is a dropped packet, not a crashed/overloaded YP
server.

>How-To-Repeat:

Code inspection? Also note the need for the recent _yplib_nerrs change
in YP.

>Fix:

This patch is for 1.2 as released (as that is what I run). I've set
RPC_RETRIES to 4, which is nice for our lossy network, but might be
too demanding for other environments.

*** yplib.c.orig	Sun May 26 08:13:58 1996
--- yplib.c	Fri Jan 17 10:22:48 1997
***************
*** 56,62 ****
  struct dom_binding *_ypbindlist;
  char _yp_domain[MAXHOSTNAMELEN];
  
! struct timeval _yplib_timeout = { 10, 0 };
  
  void _yp_unbind __P((struct dom_binding *));
  
--- 56,64 ----
  struct dom_binding *_ypbindlist;
  char _yp_domain[MAXHOSTNAMELEN];
  
! #define RPC_TIMEOUT	10
! #define RPC_RETRIES	4
! struct timeval _yplib_timeout = { RPC_TIMEOUT, 0 };
  
  void _yp_unbind __P((struct dom_binding *));
  
***************
*** 74,79 ****
--- 76,82 ----
  	CLIENT         *client;
  	int             new = 0, r;
  	int             count = 0;
+ 	struct timeval  tv;
  
  	if (dom == NULL || *dom == 0)
  		return YPERR_BADARGS;
***************
*** 219,227 ****
  	if (ysd->dom_client)
  		clnt_destroy(ysd->dom_client);
  	ysd->dom_socket = RPC_ANYSOCK;
  	ysd->dom_client = clntudp_create(&ysd->dom_server_addr,
! 				      YPPROG, YPVERS, _yplib_timeout,
! 				      &ysd->dom_socket);
  	if (ysd->dom_client == NULL) {
  		clnt_pcreateerror("clntudp_create");
  		ysd->dom_vers = -1;
--- 222,231 ----
  	if (ysd->dom_client)
  		clnt_destroy(ysd->dom_client);
  	ysd->dom_socket = RPC_ANYSOCK;
+ 	tv.tv_sec = RPC_TIMEOUT / RPC_RETRIES;
+ 	tv.tv_usec = 1000000 * (RPC_TIMEOUT % RPC_RETRIES) / RPC_RETRIES;
  	ysd->dom_client = clntudp_create(&ysd->dom_server_addr,
! 				      YPPROG, YPVERS, tv, &ysd->dom_socket);
  	if (ysd->dom_client == NULL) {
  		clnt_pcreateerror("clntudp_create");
  		ysd->dom_vers = -1;

>Audit-Trail:
>Unformatted: