byron1st
byron1st

Reputation: 981

"Minimum memory limit allowed is 4MB" failure during the chaincode instantiation

After successfully installing the chaincode on each peer, instantiating the chaincode fails because of "Minimum memory limit allowed is 4MB" error.

On orderer, it prints:

Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: API error (400): {"message":"Minimum memory limit allowed is 4MB"}

Then, on the peer, it prints:

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"}

How can I handle this error? What exactly does the message mean?

The Fabric version is 1.0-rc and this network is tested on the embedded environment, which has limitations on hardware resources.

Upvotes: 0

Views: 2238

Answers (1)

Dumi Loghin
Dumi Loghin

Reputation: 26

I had the same issue when running Hyperledger v0.6 on a Raspberry Pi 3.

You need to modify peer/core.yaml and change Memory value from 2147483648 to something that is lower than your memory size (in my case I just put 134217728 which is less than the 972230656 B of the system):

-            Memory: 2147483648
+            Memory: 134217728

You may also want to change line 36 of core/ledger/statemgmt/buckettree/data_key.go:

-       bucketNumber := int(bucketHash)%conf.getNumBucketsAtLowestLevel() + 1
+       bucketNumber := int(bucketHash % uint32(conf.getNumBucketsAtLowestLevel()) + 1)

because bucketHash is uint32 and int is 32 bits on a Raspberry Pi (or any other 32-bit system). Thus, you may get a negative bucketNumber which produces this fatal error:

panic: Invalid bucket number [-483217]. Bucket nuber at level [9] can be between 1 and [1000003]

After you make these changes, recompile peer:

$ make peer

Upvotes: 1

Related Questions