Skip to content

chassisd crash: wrong type of argument to FieldValuePairs #16465

@anamehra

Description

@anamehra

Description

Chassisd id crashing on Linecards:

Sep  6 15:37:14.559156 sfd-vt2-lc0 INFO pmon#supervisord: chassisd pzctl-zone3/power_state: All rails powered on
Sep  6 15:37:14.559285 sfd-vt2-lc0 INFO pmon#supervisord: chassisd Traceback (most recent call last):  
Sep  6 15:37:14.559285 sfd-vt2-lc0 INFO pmon#supervisord: chassisd   File "/usr/local/bin/chassisd", line 624, in <module>
Sep  6 15:37:14.559293 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     main()                          
Sep  6 15:37:14.559301 sfd-vt2-lc0 INFO pmon#supervisord: chassisd   File "/usr/local/bin/chassisd", line 619, in main
Sep  6 15:37:14.559391 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     chassisd.run()                  
Sep  6 15:37:14.559391 sfd-vt2-lc0 INFO pmon#supervisord: chassisd   File "/usr/local/bin/chassisd", line 597, in run
Sep  6 15:37:14.559519 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     self.module_updater.module_db_update()
Sep  6 15:37:14.559519 sfd-vt2-lc0 INFO pmon#supervisord: chassisd   File "/usr/local/bin/chassisd", line 309, in module_db_update
Sep  6 15:37:14.559627 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     hostname_fvs = swsscommon.FieldValuePairs([(CHASSIS_MODULE_INFO_SLOT_FIELD, self.my_slot), 
Sep  6 15:37:14.559627 sfd-vt2-lc0 INFO pmon#supervisord: chassisd   File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 229, in __init__
Sep  6 15:37:14.559627 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     _swsscommon.FieldValuePairs_swiginit(self, _swsscommon.new_FieldValuePairs(*args))
Sep  6 15:37:14.559644 sfd-vt2-lc0 INFO pmon#supervisord: chassisd TypeError: Wrong number or type of arguments for overloaded function 'new_FieldValuePairs'.                                         
Sep  6 15:37:14.559644 sfd-vt2-lc0 INFO pmon#supervisord: chassisd   Possible C/C++ prototypes are:    
Sep  6 15:37:14.559667 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     std::vector< std::pair< std::string,std::string > >::vector()
Sep  6 15:37:14.559667 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     std::vector< std::pair< std::string,std::string > >::vector(std::vector< std::pair< std::string,std::string > > const &)
Sep  6 15:37:14.559675 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     std::vector< std::pair< std::string,std::string > >::vector(std::vector< std::pair< std::string,std::string > >::size_type)
Sep  6 15:37:14.559675 sfd-vt2-lc0 INFO pmon#supervisord: chassisd     std::vector< std::pair< std::string,std::string > >::vector(std::vector< std::pair< std::string,std::string > >::size_type,std::vector<
std::pair< std::string,std::string > >::value_type const &) 

The issue is in the new code introduced by sonic-net/sonic-platform-daemons#394

      hostname_fvs = swsscommon.FieldValuePairs([(CHASSIS_MODULE_INFO_SLOT_FIELD, **self.my_slot**), 
                                                    (CHASSIS_MODULE_INFO_HOSTNAME_FIELD, hostname),
                                                    (CHASSIS_MODULE_INFO_NUM_ASICS_FIELD, str(len(module_info_dict[CHASSIS_MODULE_INFO_ASICS])))])

The API expects arg as string, self.my_slot should be str(self.my_slot)

Steps to reproduce the issue:

  1. Load image on LC with above PR
  2. check syslogs for pmon logs

Describe the results you received:

chassisd crashed

Describe the results you expected:

chassisd should not crash

Output of show version:

202205 ref c4c2c00c1132429e84b29ae61694d2dc9efe848a

Output of show techsupport:

(paste your output here or download and attach the file here )

Additional information you deem important (e.g. issue happens only occasionally):

Metadata

Metadata

Assignees

Labels

P0Priority of the issueTriagedthis issue has been triaged

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions