PRC编程 常见问题node
RPC编程经常会碰到各类问题,尤为对于刚接触和使用RPC的开发人员而言,有些简单的问题却很难经过GDB等常规手段定位。所以,这篇博文概括了RPC开发过程当中常见的一些问题和解决办法,以便本身从此参考。固然,随着对RPC的更多接触,会碰到更多的问题,将会在后面陆续整理到一块儿。编程
1. RPC: Unable to receive 错误数据结构
现象以下:app
[root@localhost bin]# ./test_rpcide
probe_nvm_ops: Fail to detect (simulated) nvm by cmds lsmod | grep "arxcis"!spa
probe_nvm_ops: Fail to detect (simulated) nvm by cmds lsmod | grep "gigaram"!线程
probe_nvm_ops: Success to detect (simulated) nvm by cmds cat /proc/cmdline | grep "mem"!xml
nvm status on 127.0.0.1: OKci
nvm status on 10.0.0.110: OK开发
10.0.0.111: RPC: Port mapper failure - RPC: Unable to receive
解决办法Solution:重启(启动)rpc服务
systemctl start rpcbind.service
2. RPC: Unable to send 错误
错误现象以下:
RPC: Port mapper failure - RPC: Unable to send
解决办法:
检查本地的IP 是否设置正确,它必须存在,且必须和注册RPC时使用的IP一致。
3. Program not registered错误
现象以下:
[root@localhost bin]# ./test_rpc
probe_nvm_ops: Fail to detect (simulated) nvm by cmds lsmod | grep "arxcis"!
probe_nvm_ops: Fail to detect (simulated) nvm by cmds lsmod | grep "gigaram"!
probe_nvm_ops: Success to detect (simulated) nvm by cmds cat /proc/cmdline | grep "mem"!
nvm status on 127.0.0.1: OK
nvm status on 10.0.0.110: OK
10.0.0.111: RPC: Program not registered
解决办法Solution: start a thread or daemon to rigeister RPC in remote node
4. 对于复杂的数据结构没有生成XDR线程
这个时候须要用rpcgen -c *.c 来自动生成XDR线程,或者.x文件格式错误、版本冲突。
固然了,实际开发过程当中碰到的问题可能千奇百怪,RPC开发过程当中碰到的问题须要结合错误信息、基于RPC底层机制,有时还须要参考自动生成的参考代码,才能高效的定位和解决问题。