VOL-4207: The mutexFlowParams Lock and mutexTPState Lock are deadlocked
on each other during concurrent gem port removal and flow setup processing.
Re-org code to fix the deadlock.
Change-Id: Idae26f2f83cd81da18d2c0319a3cda1d0430034a
diff --git a/VERSION b/VERSION
index 673c471..bf48aaf 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.3.2-dev215
+1.3.2-dev216
diff --git a/internal/pkg/onuadaptercore/omci_vlan_config.go b/internal/pkg/onuadaptercore/omci_vlan_config.go
index 258731e..3767d9d 100644
--- a/internal/pkg/onuadaptercore/omci_vlan_config.go
+++ b/internal/pkg/onuadaptercore/omci_vlan_config.go
@@ -1082,13 +1082,15 @@
oFsm.actualUniVlanConfigMeter = oFsm.uniVlanFlowParamsSlice[0].Meter
tpID := oFsm.actualUniVlanConfigRule.TpID
oFsm.TpIDWaitingFor = tpID
+ //cmp also usage in EVTOCDE create in omci_cc
+ oFsm.evtocdID = macBridgeServiceProfileEID + uint16(oFsm.pOnuUniPort.macBpNo)
+ oFsm.mutexFlowParams.Unlock()
+
loTechProfDone := oFsm.pUniTechProf.getTechProfileDone(ctx, oFsm.pOnuUniPort.uniID, uint8(tpID))
logger.Debugw(ctx, "UniVlanConfigFsm - start with first rule", log.Fields{
"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.uniID,
"set-Vlan": oFsm.actualUniVlanConfigRule.SetVid, "tp-id": tpID, "ProfDone": loTechProfDone})
- //cmp also usage in EVTOCDE create in omci_cc
- oFsm.evtocdID = macBridgeServiceProfileEID + uint16(oFsm.pOnuUniPort.macBpNo)
- oFsm.mutexFlowParams.Unlock()
+
// Can't call FSM Event directly, decoupling it
go func(aPAFsm *AdapterFsm, aTechProfDone bool) {
if aPAFsm != nil && aPAFsm.pFsm != nil {
diff --git a/internal/pkg/onuadaptercore/onu_uni_tp.go b/internal/pkg/onuadaptercore/onu_uni_tp.go
index 0f2b8e6..7d05a37 100644
--- a/internal/pkg/onuadaptercore/onu_uni_tp.go
+++ b/internal/pkg/onuadaptercore/onu_uni_tp.go
@@ -226,8 +226,9 @@
if !onuTP.waitForTimeoutOrCompletion(ctx, onuTP.chTpConfigProcessingStep, processingStep) {
//timeout or error detected
onuTP.mutexTPState.RLock()
- defer onuTP.mutexTPState.RUnlock()
- if onuTP.tpProfileExists[uniTpKey] {
+ ok := onuTP.tpProfileExists[uniTpKey]
+ onuTP.mutexTPState.RUnlock()
+ if ok {
//ignore the internal error in case the new profile is already configured
// and abort the processing here
return