2017-01-13 129 views
1

我一直在使用HFC SDK使用Node.js語言,它用來工作,但因爲昨天晚上我有一些問題。IBM BLUEMIX BLOCKCHAIN SDK-DEMO失敗

當運行helloblockchain.js只有幾次的作品,當它嘗試註冊一個新用戶最多的時間我得到這個錯誤:

E0113 11:56:05.983919636 5288 handshake.c:128]   Security handshake failed: {"created":"@1484304965.983872199","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1484304965.983866102","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_epoll_linux.c","file_line":948}]} 

Error: Failed to register and enroll JohnDoe: Error 

其他時候,登記工作,並出現在部署chaincode失敗的原因:

Enrolled and registered JohnDoe successfully 

Deploying chaincode ... 
E0113 12:14:27.341527043 5455 handshake.c:128]   Security handshake failed: {"created":"@1484306067.341430168","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1484306067.341421859","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_epoll_linux.c","file_line":948}]} 

Failed to deploy chaincode: request={"fcn":"init","args":["a","100","b","200"],"chaincodePath":"chaincode","certificatePath":"/certs/peer/cert.pem"}, error={"error":{"code":14,"metadata":{"_internal_repr":{}}},"msg":"Error"} 

或者:

Enrolled and registered JohnDoe successfully 

Deploying chaincode ... 
E0113 12:15:27.448867739 5483 handshake.c:128]   Security handshake failed: {"created":"@1484306127.448692244","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1484306127.448668047","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_epoll_linux.c","file_line":948}]} 
events.js:160 
    throw er; // Unhandled 'error' event 
^

Error 
at ClientDuplexStream._emitStatusIfDone (/usr/lib/node_modules/hfc/node_modules/grpc/src/node/src/client.js:189:19) 
at ClientDuplexStream._readsDone (/usr/lib/node_modules/hfc/node_modules/grpc/src/node/src/client.js:158:8) 
at readCallback (/usr/lib/node_modules/hfc/node_modules/grpc/src/node/src/client.js:217:12) 
E0113 12:15:27.563487641 5483 handshake.c:128]   Security handshake failed: {"created":"@1484306127.563437122","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1484306127.563429661","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_epoll_linux.c","file_line":948}]} 

此代碼昨天工作,所以我不知道會發生什麼。

有誰知道我該如何解決?

感謝, 哈維爾。

IBM-bluemix

blockchain

回答

0

這些類型的間歇性問題通常與GRPC。最初的建議是確保您至少使用GRPC版本1.0.0。

如果您使用的是Mac,然後打開文件描述符的最大數量應(使用ulimit -n)檢查。有時候,這個值初始設置爲一個較低的值,例如256,所以增加值可能會有所幫助。

有幾個有類似症狀GRPC問題。

還有是在一些問題提到一個grpc.initial_reconnect_backoff_ms屬性。增加超過1000毫秒級別的值可能有助於減少問題發生的頻率。以下是如何修改helloblockchain.js文件以將此屬性設置爲更高值的說明。

  1. 公開賽在Hyperledger面料客戶端例如helloblockchain.js文件並找到enrollAndRegisterUsers功能。
  2. 添加「grpc.initial_reconnect_backoff_ms": 5000setMemberServicesUrl通話。

    chain.setMemberServicesUrl(ca_url, { 
         pem: cert, "grpc.initial_reconnect_backoff_ms": 5000 
    }); 
    
  3. 添加「grpc.initial_reconnect_backoff_ms": 5000addPeer通話。

    chain.addPeer("grpcs://" + peers[i].discovery_host + ":" + peers[i].discovery_port, 
    {pem: cert, "grpc.initial_reconnect_backoff_ms": 5000 
    });  
    

注意,設置grpc.initial_reconnect_backoff_ms財產可能會減少問題的頻率,但它並不一定會消除所有的問題。

連接到helloblockchain.js文件中的eventhub也可能是一個因素。 Hyperledger Fabric Client的早期版本不使用eventhub。這個早期的版本可能會試圖確定這是否有所作爲。運行git clone https://github.com/IBM-Blockchain/SDK-Demo.git後,運行git checkout b7d5195以使用此先前級別。在從Node.js命令窗口運行node helloblockchain.js之前,可以使用git status命令來檢查正在使用的代碼級別。