sonic-net / sonic-platform-daemons

Platform module daemons for SONiC
Other
25 stars 159 forks source link

[202305] Remove redundant xcvr_table_helper init during CmisManagerTask init #525

Closed mihirpat1 closed 2 months ago

mihirpat1 commented 4 months ago

202305 Cherry-pick for https://github.com/sonic-net/sonic-platform-daemons/pull/521

Description

During XCVRD boot-up, following messages are seen

/var/log/syslog.95.gz:Jun 28 09:59:05.175489 svcstr-7050-acs-2 NOTICE pmon#xcvrd[30]: :- ~RedisPipeline: RedisPipeline dtor is called from another thread, possibly due to exit(), Database: STATE_DB
/var/log/syslog.95.gz:Jun 28 09:59:05.175489 svcstr-7050-acs-2 NOTICE pmon#xcvrd[30]: message repeated 3 times: [ :- ~RedisPipeline: RedisPipeline dtor is called from another thread, possibly due to exit(), Database: STATE_DB]
/var/log/syslog.95.gz:Jun 28 09:59:05.175489 svcstr-7050-acs-2 NOTICE pmon#xcvrd[30]: :- ~RedisPipeline: RedisPipeline dtor is called from another thread, possibly due to exit(), Database: APPL_DB
/var/log/syslog.95.gz:Jun 28 09:59:05.175489 svcstr-7050-acs-2 NOTICE pmon#xcvrd[30]: :- ~RedisPipeline: RedisPipeline dtor is called from another thread, possibly due to exit(), Database: CONFIG_DB
/var/log/syslog.95.gz:Jun 28 09:59:05.175489 svcstr-7050-acs-2 NOTICE pmon#xcvrd[30]: :- ~RedisPipeline: RedisPipeline dtor is called from another thread, possibly due to exit(), Database: STATE_DB

Motivation and Context

The above messages are seen since the already established connections to redis-db from xcvrd main thread are closed by CmisManagerTask thread. Following is the sequence

  1. In the context of xcvrd main thread, the CmisManagerTask.xcvr_table_helper is initialized here. This initiates connections to redis-db.
  2. Once the CmisManagerTask thread is spawned, the previously established connections from the xcvrd main thread to redis-db are closed by CmisManagerTask thread. Also, new connections are initiated in context of CmisManagerTask thread through this. This causes the messages to appear.

In order to fix the current issue, the XcvrTableHelper instantiation from CmisManagerTask.__init__ has now been removed since the instantiation is already being done as part of task_worker function in the context of CmisManagerTask thread.

How Has This Been Tested?

Ensured that the messages are not seen any more during xcvrd boot-up. Also, ensured that the CmisManagerTask thread is running without any crashes. Also, issued shut/no shut on a port to ensure that CmisManagerTask and xcvrd are stable.

Additional Information (Optional)

MSFT ADO - 28645242