[VOL-4686] openonuAdapterGo: Panic during memory leak test
Change-Id: Id37ec3d5eaf579e926c913b1f15d5a9c0ca09bb9
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)