[VOL-4686] openonuAdapterGo: Panic during memory leak test
Change-Id: Id37ec3d5eaf579e926c913b1f15d5a9c0ca09bb9
diff --git a/VERSION b/VERSION
index b1b25a5..baa9d04 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.2
+2.2.3-dev279
diff --git a/internal/pkg/avcfg/omci_ani_config.go b/internal/pkg/avcfg/omci_ani_config.go
index 92fe84f..64d4c0b 100755
--- a/internal/pkg/avcfg/omci_ani_config.go
+++ b/internal/pkg/avcfg/omci_ani_config.go
@@ -264,6 +264,7 @@
//CancelProcessing ensures that suspended processing at waiting on some response is aborted and reset of FSM
func (oFsm *UniPonAniConfigFsm) CancelProcessing(ctx context.Context) {
+ logger.Debugw(ctx, "CancelProcessing entered", log.Fields{"device-id": oFsm.deviceID})
//early indication about started reset processing
oFsm.pUniTechProf.setProfileResetting(ctx, oFsm.pOnuUniPort.UniID, oFsm.techProfileID, true)
//mutex protection is required for possible concurrent access to FSM members
diff --git a/internal/pkg/avcfg/omci_vlan_config.go b/internal/pkg/avcfg/omci_vlan_config.go
index 48353b9..2a93da2 100755
--- a/internal/pkg/avcfg/omci_vlan_config.go
+++ b/internal/pkg/avcfg/omci_vlan_config.go
@@ -354,6 +354,7 @@
//CancelProcessing ensures that suspended processing at waiting on some response is aborted and reset of FSM
func (oFsm *UniVlanConfigFsm) CancelProcessing(ctx context.Context) {
+ logger.Debugw(ctx, "CancelProcessing entered", log.Fields{"device-id": oFsm.deviceID})
if oFsm == nil {
logger.Error(ctx, "no valid UniVlanConfigFsm!")
return
diff --git a/internal/pkg/common/omci_cc.go b/internal/pkg/common/omci_cc.go
index 6c01694..e1115d3 100755
--- a/internal/pkg/common/omci_cc.go
+++ b/internal/pkg/common/omci_cc.go
@@ -4790,14 +4790,17 @@
//CancelRequestMonitoring terminates monitoring of outstanding omci requests
func (oo *OmciCC) CancelRequestMonitoring(ctx context.Context) {
+ logger.Debugw(ctx, "CancelRequestMonitoring entered", log.Fields{"device-id": oo.deviceID})
oo.mutexMonReq.RLock()
for k := range oo.monitoredRequests {
//implement non-blocking channel send to avoid blocking on mutexMonReq later
select {
case oo.monitoredRequests[k].chSuccess <- false:
+ logger.Debugw(ctx, "send cancellation on omciRespChannel",
+ log.Fields{"index": k, "device-id": oo.deviceID})
default:
- logger.Debugw(ctx, "cancel not send on omciRespChannel (no receiver)", log.Fields{
- "index": k, "device-id": oo.deviceID})
+ logger.Debugw(ctx, "cancellation could not be send on omciRespChannel (no receiver)",
+ log.Fields{"index": k, "device-id": oo.deviceID})
}
}
oo.mutexMonReq.RUnlock()
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index d65b1b0..5b67345 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -2200,6 +2200,7 @@
//it is not sufficient to stop/reset the latest running FSM as done in previous versions
// as after down/up procedures all FSM's might be active/ongoing (in theory)
// and using the stop/reset event should never harm
+ logger.Debugw(ctx, "resetFsms entered", log.Fields{"device-id": dh.DeviceID})
pDevEntry := dh.GetOnuDeviceEntry(ctx, false)
if pDevEntry == nil {
@@ -4530,7 +4531,17 @@
// Note: This function must be called as a goroutine to prevent blocking of further processing!
// first let the objects rest for some time to give all asynchronously started
// cleanup routines a chance to come to an end
- time.Sleep(5 * time.Second)
+ time.Sleep(2 * time.Second)
+
+ if dh.pOnuOmciDevice != nil {
+ if dh.pOnuOmciDevice.PDevOmciCC != nil {
+ // Since we cannot rule out that one of the handlers had initiated any OMCI configurations during its
+ // reset handling (even in future coding), request monitoring is canceled here one last time to
+ // be sure that all corresponding go routines are terminated
+ dh.pOnuOmciDevice.PDevOmciCC.CancelRequestMonitoring(ctx)
+ }
+ }
+ time.Sleep(3 * time.Second)
if dh.pOnuTP != nil {
dh.pOnuTP.PrepareForGarbageCollection(ctx, aDeviceID)
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index 8636aa7..ea91efb 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -1303,7 +1303,7 @@
//CancelProcessing terminates potentially running reconciling processes and stops the FSM
func (oo *OnuDeviceEntry) CancelProcessing(ctx context.Context) {
-
+ logger.Debugw(ctx, "CancelProcessing entered", log.Fields{"device-id": oo.deviceID})
if oo.isReconcilingFlows() {
oo.SendChReconcilingFlowsFinished(ctx, false)
}
diff --git a/internal/pkg/swupg/omci_onu_upgrade.go b/internal/pkg/swupg/omci_onu_upgrade.go
index 006c62c..481f349 100755
--- a/internal/pkg/swupg/omci_onu_upgrade.go
+++ b/internal/pkg/swupg/omci_onu_upgrade.go
@@ -531,6 +531,7 @@
func (oFsm *OnuUpgradeFsm) CancelProcessing(ctx context.Context, abCompleteAbort bool,
aReason voltha.ImageState_ImageFailureReason) {
pAdaptFsm := oFsm.PAdaptFsm
+ logger.Debugw(ctx, "CancelProcessing entered", log.Fields{"device-id": oFsm.deviceID})
if pAdaptFsm == nil || pAdaptFsm.PFsm == nil {
logger.Warnw(ctx, "OnuUpgradeFsm cancel, but FSM invalid", log.Fields{
"device-id": oFsm.deviceID})
diff --git a/internal/pkg/swupg/onu_image_status.go b/internal/pkg/swupg/onu_image_status.go
index ae798d0..b38fd5e 100755
--- a/internal/pkg/swupg/onu_image_status.go
+++ b/internal/pkg/swupg/onu_image_status.go
@@ -297,6 +297,7 @@
//CancelProcessing ensures that interrupted processing is canceled while waiting for a response
func (oo *OnuImageStatus) CancelProcessing(ctx context.Context) {
+ logger.Debugw(ctx, "CancelProcessing entered", log.Fields{"device-id": oo.deviceID})
if oo.isWaitingForResp() {
abortMsg := cmn.Message{
Type: cmn.TestMsg,