Skip to content

Commit d16ce12

Browse files
committed
[FAB-8844] correct handling of launch errors
An error during launch is incorrectly handled by partial deregistration. This error maybe benign and ignored by system, thus causing the deregistration to leave it in an inconsitent state where it believes the chaincode is not registered (and running) when it actually is. This causes subsequent invoke to attempt to restart. The fix is to have errors handled at the right decision point with existing error mechanism naturally handling them.. Change-Id: I9c655a5355991b2426b88986aa7da1f7145ba15e Signed-off-by: Srinivasan Muralidharan <srinivasan.muralidharan99@gmail.com>
1 parent bf53291 commit d16ce12

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/chaincode/chaincode_support.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,12 @@ func (chaincodeSupport *ChaincodeSupport) launchAndWaitForRegister(ctxt context.
542542
if err == nil {
543543
err = resp.(container.VMCResp).Err
544544
}
545+
546+
//if the launch was successful and leads to proper registration,
547+
//this error could be ignored in the select below. On the other
548+
//hand the error might be triggered for select in which case
549+
//the launch will be cleaned up
545550
err = errors.WithMessage(err, "error starting container")
546-
chaincodeSupport.runningChaincodes.Lock()
547-
delete(chaincodeSupport.runningChaincodes.chaincodeMap, canName)
548-
chaincodeSupport.runningChaincodes.Unlock()
549551
}
550552
}()
551553

0 commit comments

Comments
 (0)