[VOL-4469] Onu adapter reconcilement may stuck on VLAN processing, especially in TT traffic scenarios
Signed-off-by: mpagenko <michael.pagenkopf@adtran.com>
Change-Id: If321388c67e2e52eb04b8a55167eb3c1c7575e5d
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index d3b3543..f36cf9d 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -333,25 +333,25 @@
// In multi-ONU/multi-flow environment stopping reconcilement has to be delayed until
// we get a signal that the processing of the last step to rebuild the adapter internal
// flow data is finished.
+ expiry := oo.baseDeviceHandler.GetReconcileExpiryVlanConfigAbort()
+ oo.setReconcilingFlows(true)
select {
case success := <-oo.chReconcilingFlowsFinished:
if success {
logger.Debugw(ctx, "reconciling flows has been finished in time",
log.Fields{"device-id": oo.deviceID})
- oo.baseDeviceHandler.StopReconciling(ctx, true)
_ = oo.PMibUploadFsm.PFsm.Event(UlEvSuccess)
} else {
logger.Debugw(ctx, "wait for reconciling flows aborted",
log.Fields{"device-id": oo.deviceID})
- oo.SetReconcilingFlows(false)
}
- case <-time.After(500 * time.Millisecond):
+ case <-time.After(expiry):
logger.Errorw(ctx, "timeout waiting for reconciling flows to be finished!",
- log.Fields{"device-id": oo.deviceID})
- oo.SetReconcilingFlows(false)
+ log.Fields{"device-id": oo.deviceID, "expiry": expiry})
_ = oo.PMibUploadFsm.PFsm.Event(UlEvMismatch)
}
+ oo.setReconcilingFlows(false)
}()
oo.baseDeviceHandler.ReconcileDeviceFlowConfig(ctx)
@@ -1120,11 +1120,8 @@
//CancelProcessing terminates potentially running reconciling processes and stops the FSM
func (oo *OnuDeviceEntry) CancelProcessing(ctx context.Context) {
- if oo.IsReconcilingFlows() {
- oo.chReconcilingFlowsFinished <- false
- }
- if oo.baseDeviceHandler.IsReconciling() {
- oo.baseDeviceHandler.StopReconciling(ctx, false)
+ if oo.isReconcilingFlows() {
+ oo.SendChReconcilingFlowsFinished(false)
}
//the MibSync FSM might be active all the ONU-active time,
// hence it must be stopped unconditionally
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index 61e852d..a6068ec 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -970,20 +970,26 @@
oo.SOnuPersistentData.PersActiveSwVersion = value
}
-// SetReconcilingFlows - TODO: add comment
-func (oo *OnuDeviceEntry) SetReconcilingFlows(value bool) {
+// setReconcilingFlows - TODO: add comment
+func (oo *OnuDeviceEntry) setReconcilingFlows(value bool) {
oo.mutexReconcilingFlowsFlag.Lock()
oo.reconcilingFlows = value
oo.mutexReconcilingFlowsFlag.Unlock()
}
-// SetChReconcilingFlowsFinished - TODO: add comment
-func (oo *OnuDeviceEntry) SetChReconcilingFlowsFinished(value bool) {
- oo.chReconcilingFlowsFinished <- value
+// SendChReconcilingFlowsFinished - TODO: add comment
+func (oo *OnuDeviceEntry) SendChReconcilingFlowsFinished(value bool) {
+ if oo != nil { //if the object still exists (might have been already deleted in background)
+ //use asynchronous channel sending to avoid stucking on non-waiting receiver
+ select {
+ case oo.chReconcilingFlowsFinished <- value:
+ default:
+ }
+ }
}
-// IsReconcilingFlows - TODO: add comment
-func (oo *OnuDeviceEntry) IsReconcilingFlows() bool {
+// isReconcilingFlows - TODO: add comment
+func (oo *OnuDeviceEntry) isReconcilingFlows() bool {
oo.mutexReconcilingFlowsFlag.RLock()
value := oo.reconcilingFlows
oo.mutexReconcilingFlowsFlag.RUnlock()