![](/img/trans.png)
[英]Bluemix Blockchain Chaincode demo producing “Undefined” error
[英]IBM BLUEMIX BLOCKCHAIN SDK-DEMO failing
我一直在使用HFC SDK for Node.js並且它曾經工作,但從昨晚起我遇到了一些問題。
當運行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
其他時候,注冊工作和失敗似乎部署鏈代碼:
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}]}
這段代碼昨天有效,所以我不知道會發生什么。
有誰知道我該怎么辦?
謝謝,哈維爾。
這些類型的間歇性問題通常與GRPC有關。 最初的建議是確保您至少使用GRPC版本1.0.0。
如果您使用的是Mac,則應檢查打開的文件描述符的最大數量(使用ulimit -n
)。 有時這最初會設置為較低的值,例如256,因此增加該值可能會有所幫助。
有幾個GRPC問題有類似的症狀。
在某些問題中提到了grpc.initial_reconnect_backoff_ms
屬性。 將值增加到1000毫秒以上可能有助於減少問題的發生頻率。 下面是如何修改helloblockchain.js文件以將此屬性設置為更高值的說明。
enrollAndRegisterUsers
函數。 將“grpc.initial_reconnect_backoff_ms": 5000
添加到setMemberServicesUrl
調用中。
chain.setMemberServicesUrl(ca_url, { pem: cert, "grpc.initial_reconnect_backoff_ms": 5000 });
將“grpc.initial_reconnect_backoff_ms": 5000
添加到addPeer
調用。
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
命令檢查正在使用的代碼級別。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.