Fix system raising alarm due to outdated file in memory

In DX system, during a forced reboot in the active controller, when the
host recovers, a 900.002 alarm is raised.
This happens because handle-install removes a flag file, but the next
service starts up in less than 200ms and the python garbage collector
was not able to remove the file from memory.

Solution: Force a garbage collector call after removing the file.

Test Plan:
    PASS: In DX, apply a patch, force reboot the active controller.
After the host was recovered, the 900.002 alarm should not be raised.

Closes-bug: 2037724
Closes-bug: 2037725

Change-Id: Idb92d2295c4330704d1ad8b1110477d64ee26583
Signed-off-by: Lindley Werner <Lindley.Vieira@windriver.com>
This commit is contained in:
Lindley Werner Soares Vieira 2023-09-18 14:42:32 -03:00 committed by Lindley Werner
parent bd32299149
commit 5aae3b75d9

View File

@ -1,9 +1,10 @@
""" """
Copyright (c) 2014-2022 Wind River Systems, Inc. Copyright (c) 2014-2023 Wind River Systems, Inc.
SPDX-License-Identifier: Apache-2.0 SPDX-License-Identifier: Apache-2.0
""" """
import gc
import json import json
import os import os
import random import random
@ -546,6 +547,9 @@ class PatchAgent(PatchService):
hello_ack = PatchMessageHelloAgentAck() hello_ack = PatchMessageHelloAgentAck()
hello_ack.send(self.sock_out) hello_ack.send(self.sock_out)
# Call python garbage collector to ensure the removal of cleared flags
gc.collect()
# Indicate if the method was successful # Indicate if the method was successful
# success means no change needed, or a change worked. # success means no change needed, or a change worked.
return success return success