IBM BLUEMIX BLOCKCHAIN SDK-DEMO失败

时间:2017-01-13 11:21:13

标签: ibm-cloud blockchain

我一直在使用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}]}

这段代码昨天有效,所以我不知道会发生什么。

有人知道我该如何解决它?

谢谢, 哈维尔。

IBM-bluemix

blockchain

1 个答案:

答案 0 :(得分:0)

这些类型的间歇性问题通常与GRPC有关。最初的建议是确保您至少使用GRPC版本1.0.0。

如果您使用的是Mac,则应检查最大打开文件描述符数(使用ulimit -n)。有时这最初会设置为较低的值,例如256,因此增加该值可能有所帮助。

有几个GRPC问题有类似的症状。

在某些问题中提到了grpc.initial_reconnect_backoff_ms属性。将值增加到1000毫秒以上可能有助于减少问题的发生频率。下面是如何修改helloblockchain.js文件以将此属性设置为更高值的说明。

  1. 打开Hyperledger Fabric Client示例中的helloblockchain.js文件,找到enrollAndRegisterUsers函数。
  2. “grpc.initial_reconnect_backoff_ms": 5000添加到setMemberServicesUrl来电。

    chain.setMemberServicesUrl(ca_url, {
            pem: cert, "grpc.initial_reconnect_backoff_ms": 5000
    });
    
  3. “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
    });       
    
  4. 请注意,设置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命令可用于检查正在使用的代码级别。