bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I encountered a problem in sunrpc tcp_clht.c and tcp_gen.c


From: maruyama
Subject: I encountered a problem in sunrpc tcp_clht.c and tcp_gen.c
Date: Wed, 01 Nov 2000 01:00:27 +0900

Dear gnu libc developers

I am using glibc 2.1.2 on linux 2.2.14 (VineLinux2.0) in Japan.

and I had one problem in using sunrpc feature.

This is my client program(simplified):

static struct timeval TIMEOUT = { 3600, 0 };
main() {
        CLIENT  *cl;
        static foo_t clnt_res;
        cl = clnt_create(server, FOORPCPROG, FOORPCVER, "tcp");
        if (clnt_call(clnt, FOO, xdr_foo_t, argp, xdr_foo_t, &clnt_res, 
TIMEOUT) != RPC_SUCCESS) {
                return (NULL);
        }
        return (&clnt_res);
}

I think this should wait for server responce for one hour,
but it times out after 25 seconds(default sunrpc timeout value).

I followed the process using gdb.

in function clnt_create() in sunrpc/clnt_gen.c
                (called from my client program)
    case IPPROTO_TCP:
      client = clnttcp_create (&sin, prog, vers, &sock, 0, 0);
      if (client == NULL)
        {
          return NULL;
        }
      tv.tv_sec = 25;
      tv.tv_usec = 0;
      clnt_control (client, CLSET_TIMEOUT, (char *)&tv);
      break;

and in function clnttcp_control() in sunrpc/clnt_tcp.c
                (called as clnt_control() from clnt_create())
    case CLSET_TIMEOUT:
      ct->ct_wait = *(struct timeval *) info;
      ct->ct_waitset = TRUE;
      break;

So, ct->ct_waitset is set TRUE everytime in clnt_create().
and ct->ct_wait is set 25 seconds (RPC default value).

in function clnttcp_call() in sunrpc/clnt_tcp.c
                (called as clnt_call() from my client program)
static enum clnt_stat
clnttcp_call (h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
     ....
     struct timeval timeout;
{
  ....  
  if (!ct->ct_waitset)
    {
      ct->ct_wait = timeout;
    }
  ....

But ct->ct_waitset is always set TRUE in clnt_create() as described above,
ct->ct_wait is never set in clnt_call().
I'm afraid that clnt_call()'s last argument timeout will never be effective.

I don't know much about sunrpc specifications,
but I think clnt_call()'s last argument should be effective,
except when the timeout value is set with clnt_control() called by USER.

I changed my client program:
        cl = clnt_create(server, FOORPCPROG, FOORPCVER, "tcp");
        if (clnt_control(clnt, CLSET_TIMEOUT, &TIMEOUT) == FALSE) {
            /* ;;; ignore */
        }
        if (clnt_call(clnt, FOO, xdr_foo_t, argp, xdr_foo_t, &clnt_res, 
TIMEOUT) != RPC_SUCCESS) {
                return (NULL);
        }
and I am happy now.

I don't know about newer glibc version under development now,
but glibc-2.1.3 (the newest version released, as I believe) has
same sunrpc/tcp_clnt.c and sunrpc/tcp_gen.c.
I will be very happy if this mail helps you.


                                  Hitoshi Guutara Maruyama //



reply via email to

[Prev in Thread] Current Thread [Next in Thread]