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/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