FISCO-BCOS / go-sdk

golang SDK of FISCO BCOS
Apache License 2.0
73 stars 58 forks source link

go-sdk使用channel调用sendTransaction时,receipt.Notify阻塞 #53

Closed Zhuchengyu04 closed 3 years ago

Zhuchengyu04 commented 4 years ago

go-sdk/conn/channel.go ----------------func (hc *channelSession) sendTransaction(ctx context.Context, msg interface{}) ([]byte, error) ----------------------------<-receipt.Notify

版本:fisco-bcos v2.3.0 solidity0.4.25 golang 1.13.6 在receipt.Notify堵塞无响应。去节点查看日志,发现节点已经异步发送,日志如下:

info|2020-08-03 22:06:55.675796|[g:1][BLOCKVERIFIER][executeBlock]Execute block takes,time(ms)=1,txNum=1,num=1,blockHash=c44617219d7b9da04ed42362f6a774b5016e628e2c257a9afeb32542d66e4815,stateRoot=66850592882819b898bac7c70adf9fee4f8d70e5dc867741b072f0604ca3f6bc,dbHash=66850592882819b898bac7c70adf9fee4f8d70e5dc867741b072f0604ca3f6bc,transactionRoot=55ba3f1a6f92b18f2f126e634bbce97d6776b440ec24c0ded5ef676fb8fda403,receiptRoot=97b6e5a0a8706801a194e39e64554357378ddcf4781af14f1868e57de46e5158,transactionReceipts=d30b8f78d6b7c13c7246c38b48f0868765b9d134 info|2020-08-03 22:06:55.675834|[g:1][CONSENSUS][PBFT],totalCost=1 info|2020-08-03 22:06:55.676562|[g:1]Re-generate prepare_requests since block has been executed, time = 1596463615675 , block_hash: c4461721... info|2020-08-03 22:06:55.676579|[g:1][CONSENSUS][PBFT]handlePrepareMsg: add prepare cache and broadcastSignReq,reqNum=1,hash=c4461721...,nodeIdx=2,addPrepareTime=1,myNode=7c022d12... info|2020-08-03 22:06:55.676864|[g:1][CONSENSUS][PBFT]handlePrepareMsg Succ,Timecost=2.642,INFO=handlePrepareMsg,reqIdx=0,view=140,reqNum=1,curNum=0,consNum=1,curView=140,fromIp=127.0.0.1:30302,hash=e9c50483...,nodeIdx=2,myNode=7c022d12...,curChangeCycle=2 info|2020-08-03 22:06:55.677395|[g:1][CONSENSUS][PBFT]handleSignMsg Succ,Timecost=0.504,INFO=handleSignMsg,num=1,curNum=0,GenIdx=1,Sview=140,view=140,fromIdx=1,fromNode=592273a4...,fromIp=127.0.0.1:30301,hash=c4461721...,nodeIdx=2,myNode=7c022d12... info|2020-08-03 22:06:55.678909|[g:1][CONSENSUS][PBFT]checkAndCommit, SignReq enough,number=1,sigSize=3,hash=c4461721...,nodeIdx=2,myNode=7c022d12... info|2020-08-03 22:06:55.678926|[g:1][CONSENSUS][PBFT]checkAndCommit: backup/updateCommittedPrepare,reqNum=1,hash=e9c50483...,nodeIdx=2,myNode=7c022d12... info|2020-08-03 22:06:55.679051|[g:1][CONSENSUS][PBFT]checkAndCommit: broadcastCommitReq,prepareHeight=1,hash=c4461721...,nodeIdx=2,myNode=7c022d12... info|2020-08-03 22:06:55.679483|[g:1][CONSENSUS][PBFT]checkAndCommit: broadcastCommitReq before checkandsave,time = =1 info|2020-08-03 22:06:55.679494|[g:1][CONSENSUS][PBFT]checkAndSave finished ,time = =0 info|2020-08-03 22:06:55.679500|[g:1][CONSENSUS][PBFT]handleSignMsg Succ,Timecost=0.951,INFO=handleSignMsg,num=1,curNum=0,GenIdx=0,Sview=140,view=140,fromIdx=0,fromNode=0e824a87...,fromIp=127.0.0.1:30302,hash=c4461721...,nodeIdx=2,myNode=7c022d12... info|2020-08-03 22:06:55.680787|[g:1][CONSENSUS][PBFT]checkAndSave finished ,time = =0 info|2020-08-03 22:06:55.680801|[g:1][CONSENSUS][PBFT]handleCommitMsg Succ,INFO=handleCommitMsg,reqNum=1,curNum=0,GenIdx=0,Cview=140,view=140,fromIdx=0,fromNode=0e824a87...,fromIp=127.0.0.1:30302,hash=c4461721...,nodeIdx=2,myNode=7c022d12...,Timecost=0.479 info|2020-08-03 22:06:55.684994|[g:1][CONSENSUS][PBFT]checkAndSave: CommitReq enough,prepareHeight=1,commitSize=3,hash=c4461721...,nodeIdx=2,myNode=7c022d12... info|2020-08-03 22:06:55.685247|[g:1][BLOCKCHAIN][WriteTxOnCommit]Write tx to block time record,openTableTimeCost=0,constructVectorTimeCost=0,insertTableTimeCost=0,encodeNonceVectorTimeCost=0,insertNonceVectorTimeCost=0,totalTimeCost=0 info|2020-08-03 22:06:55.685359|[g:1][g:1][STORAGE][CachedStorage]CachedStorage commit: 8 num: 1 info|2020-08-03 22:06:55.687334|[g:1][STORAGE]Start commit block: 1 to backend storage info|2020-08-03 22:06:55.687863|[g:1][STORAGE][RocksDB][Commit]Write to db,encodeTimeCost=0,writeDBTimeCost=0,totalTimeCost=0 info|2020-08-03 22:06:55.687883|[g:1][STORAGE][g:1]

Commit block: 1 to backend storage finished, current cached block: 1 Flush elapsed time: 0.0006s

info|2020-08-03 22:06:55.688039|[g:1][STORAGE]Submited block task: 1, current syncd block: 1 info|2020-08-03 22:06:55.688085|[g:1][STORAGE][Commit]Commit db time record,getDataTimeCost=0,commitTimeCost=3,clearTimeCost=0,totalTimeCost=3 info|2020-08-03 22:06:55.688103|[g:1][BLOCKCHAIN][Commit]Commit block time record(write),writeHash2BlockTimeCost=0,writeNumber2HashTimeCost=0,writeNumberTimeCost=0,writeTotalTransactionCountTimeCost=0,writeTxToBlockTimeCost=0,dbCommitTimeCost=3,updateBlockNumberTimeCost=0 info|2020-08-03 22:06:55.688342|[g:1][SYNC][id:7c022d12...][sendSyncStatusByTree],blockNumber=1,currentHash=c4461721...,selectedNodes=2 info|2020-08-03 22:06:55.688376|[g:1][SYNC][id:7c022d12...][Status]Send current status when maintainBlocks,number=1,genesisHash=6ac93b39...,currentHash=c4461721...,peer=0e824a87... info|2020-08-03 22:06:55.688403|[g:1][SYNC][id:7c022d12...][Status]Send current status when maintainBlocks,number=1,genesisHash=6ac93b39...,currentHash=c4461721...,peer=592273a4... info|2020-08-03 22:06:55.688529|[g:1] [SYNC][id:7c022d12...][Status]Receive status from peer,peerNodeId=0e824a87...,peerBlockNumber=1,genesisHash=6ac93b39...,latestHash=c4461721... info|2020-08-03 22:06:55.688552|[g:1] [SYNC][id:7c022d12...][Status]Receive status from peer,peerNodeId=592273a4...,peerBlockNumber=1,genesisHash=6ac93b39...,latestHash=c4461721... info|2020-08-03 22:06:55.688565|[g:1]Push block notify: 1-1 **

** info|2020-08-03 22:06:55.688666|[g:1][BLOCKCHAIN][Commit]Commit block time record,beforeTimeCost=0,writeBlockTimeCost=3,addBlockCacheTimeCost=0,noteReadyTimeCost=0,totalTimeCost=3 info|2020-08-03 22:06:55.689183|[g:1][CONSENSUS][PBFT]CommitBlock Succ,prepareHeight=1,reqIdx=0,hash=c4461721...,nodeIdx=2,myNode=7c022d12...,genSigTimeCost=1,commitBlockTimeCost=3,dropTxsTimeCost=1,noteSealingTimeCost=0,totalTimeCost=5 info|2020-08-03 22:06:55.689199|[g:1][CONSENSUS]delCache,hash=c4461721... info|2020-08-03 22:06:55.689211|[g:1][CONSENSUS][PBFT]checkAndSave finished ,time = =5 info|2020-08-03 22:06:55.689216|[g:1][CONSENSUS][PBFT]handleCommitMsg Succ,INFO=handleCommitMsg,reqNum=1,curNum=0,GenIdx=1,Cview=140,view=140,fromIdx=1,fromNode=592273a4...,fromIp=127.0.0.1:30301,hash=c4461721...,nodeIdx=2,myNode=7c022d12...,Timecost=4.671 info|2020-08-03 22:06:55.689303|[g:1][CONSENSUS][ConsensusEngine]resetConfig: updateMaxBlockTransactions,txCountLimit=500 info|2020-08-03 22:06:55.689322|[g:1][CONSENSUS][SEALER]increase maxNoTimeoutTx,maxNoTimeoutTx=1 info|2020-08-03 22:06:55.689328|[g:1][CONSENSUS]delCache,hash=c4461721... info|2020-08-03 22:06:55.689333|[g:1][CONSENSUS][PBFT]^^^^^^^^Report,num=1,sealerIdx=0,hash=c4461721...,next=2,tx=1,nodeIdx=2

Zhuchengyu04 commented 4 years ago

个人测试发现是topic 订阅服务无效。使用简单demo测试topic,发现发送成功但接收失败。认为上述的问题也是由于receipt是使用依据topic发送网络消息,造成sdk未接收到节点发送的消息

bxq2011hust commented 4 years ago

个人测试发现是topic 订阅服务无效。使用简单demo测试topic,发现发送成功但接收失败。认为上述的问题也是由于receipt是使用依据topic发送网络消息,造成sdk未接收到节点发送的消息

0.9.0应该修复了这个问题,或者使用马上要发布的0.10.0也可以

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.