Issue with mbuf de-allocation when using NFS in RTEMS

Ben Dart Ben.Dart at
Thu Nov 2 01:28:38 UTC 2017

We are using NFS with our RTEMS system. We are getting the following print out at times from the NFS subsystem:

                NFS (proc 1) - RPC: Can't decode result
                RPCIO WARNING sockRcv(): transaction mismatch
xact: xid  0x00336d76  -- got 0x00336376
xact: addr 0xc0a8fe65  -- got 0xc0a8fe65
xact: port 0x00000801  -- got 0x00000801
NFS (proc 1) - RPC: Can't decode result
NFS (proc 4) - RPC: Can't decode result
NFS (proc 8) - RPC: Can't decode result
NFS (proc 8) - RPC: Can't decode result

We are not sure why we get the RPC, Cant decode result, but this is not necessarily the bad behavior. When this happens we notice that the number of MBUFS available reduces and doesn't come back. Over a period of 1-2 days eventually we run out of MBUFS and can no longer communicate with RTEMS. Looking in the code, it is clear this error is produced from here:


      xdrmem_create(&reply_xdrs, xact->ibuf->buf, xact->ibufsize, XDR_DECODE); // !!!!! We think the buffer is created

      reply_msg.acpted_rply.ar_verf          = _null_auth;
      reply_msg.acpted_rply.ar_results.where = xact->pres;
      reply_msg.acpted_rply.ar_results.proc  = xact->xres;

      if (xdr_replymsg(&reply_xdrs, &reply_msg)) { // !!!!!!! This reply message is not successful
            /* OK */
            _seterr_reply(&reply_msg, &xact->status);
            if (RPC_SUCCESS == xact->status.re_status) {
                  if ( !locked_validate(xact->server,
                                                &reply_msg.acpted_rply.ar_verf) ) {
                        xact->status.re_status = RPC_AUTHERROR;
                        xact->status.re_why    = AUTH_INVALIDRESP;
                  if (reply_msg.acpted_rply.ar_verf.oa_base) {
                        reply_xdrs.x_op = XDR_FREE;
                        xdr_opaque_auth(&reply_xdrs, &reply_msg.acpted_rply.ar_verf);
                  refresh = 0;
            } else {
                  /* should we try to refresh our credentials ? */
                  if ( !refresh ) {
                        /* had never tried before */
                        refresh = RPCIOD_REFRESH;
      } else {
            reply_xdrs.x_op        = XDR_FREE;
            xdr_replymsg(&reply_xdrs, &reply_msg);
            xact->status.re_status = RPC_CANTDECODERES; // !!!!!!!!! Here is where the error is made that results in the print out

      bufFree(&xact->ibuf); // !!!!!!!!!! I would have thought we free the mbuf here (ie. This eventually results in the "MFREE" macro

But still, eventually, we run out of MBUFS and the system is inoperable. We are running an old version of RTEMS (4.9.2) but even compared to the newer version 4.11 we can see any significant changes in this or the NFS related files that would suggest a fix for this behavior. Is this well-known and is there a patch for it?

Ben Dart

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list