在每个对等节点上成功安装链码后,由于“允许的最小内存限制为4MB”错误,无法实例化链码。
在订购者上,它会打印:
Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: API error (400): {"message":"Minimum memory limit allowed is 4MB"}
然后在同级机上打印:
2018-07-10 08:02:35.893 UTC [dockercontroller] Start -> ERRO 610 start-could not recreate container <10.11.1.121-10.11.1.121-mycc-1.0>, because of API error (400): {"message":"Minimum memory limit allowed is 4MB"}
2018-07-10 08:02:35.893 UTC [container] unlockContainer -> DEBU 611 container lock deleted(10.11.1.121-10.11.1.121-mycc-1.0)
2018-07-10 08:02:35.893 UTC [chaincode] Launch -> ERRO 612 launchAndWaitForRegister failed Error starting container: API error (400): {"message":"Minimum memory limit allowed is 4MB"}
2018-07-10 08:02:35.893 UTC [endorser] callChaincode -> DEBU 613 Exit
2018-07-10 08:02:35.894 UTC [endorser] simulateProposal -> ERRO 614 failed to invoke chaincode name:"lscc" on transaction c67380e075c9a178cd11b6570cf774c616249a5a1412bdc2f96ebecc3d7bbb7b, error: Error starting container: API error (400): {"message":"Minimum memory limit allowed is 4MB"}
如何处理此错误?该消息到底是什么意思?
Fabric版本为1.0-rc,并且该网络已在嵌入式环境中进行了测试,这对硬件资源有限制。
答案 0 :(得分:1)
在Raspberry Pi 3上运行Hyperledger v0.6时,我遇到了同样的问题。
您需要修改 peer / core.yaml 并将 Memory 值从2147483648更改为小于您的内存大小(在我的情况下,我只输入了134217728小于系统的972230656 B):
- Memory: 2147483648
+ Memory: 134217728
您可能还想更改 core / ledger / statemgmt / buckettree / data_key.go 的第36行:
- bucketNumber := int(bucketHash)%conf.getNumBucketsAtLowestLevel() + 1
+ bucketNumber := int(bucketHash % uint32(conf.getNumBucketsAtLowestLevel()) + 1)
因为在Raspberry Pi(或任何其他32位系统)上,bucketHash是uint32,而int是32位。因此,您可能会得到一个负的bucketNumber,从而产生此致命错误:
panic: Invalid bucket number [-483217]. Bucket nuber at level [9] can be between 1 and [1000003]
进行这些更改后,重新编译对等体:
$ make peer