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底層機制,有時還須要參考自動生成的參考代碼,才能高效的定位和解決問題。