You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[swss-common] Enhanced NotificationConsumer queue to avoid memory leaks in some cases
Why I did it
In the current notification mechanism, the NotificationConsumer stores notification messages in bulk to an internal queue.
However, when the various Orch consumers receive notifications, they only retrieve one notification from the queue for processing at a time.
This approach has a potential risk of memory leaks. If the device is hit by a large number of FDB move or link up/down flapping events,
a significant increase in memory consumption by the orchagent can be observed,
eventually leading to a system crash or hang.
(Testing has been done on SONiC 202111, where the orchagent's memory consumption reached up to 10GB and continued to increase)
How I did it
Modified the internal queue of the NotificationConsumer class to replace std::queue.
Now, when processing existing duplicate messages, the NotificationConsumer will no longer enqueue them and
will instead move the existing message to the end of the queue (as a penalty for DDOS).
This significantly reduces the number of duplicate notify messages, and the time complexity for both lookup and insertion in the new queue is O(1).
0 commit comments