Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chassisd crash: wrong type of argument to FieldValuePairs #16465

Closed
anamehra opened this issue Sep 6, 2023 · 3 comments
Closed

chassisd crash: wrong type of argument to FieldValuePairs #16465

anamehra opened this issue Sep 6, 2023 · 3 comments
Assignees
Labels
P0 Priority of the issue Triaged this issue has been triaged

Comments

@anamehra
Copy link
Contributor

anamehra commented Sep 6, 2023

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):

@anamehra
Copy link
Contributor Author

anamehra commented Sep 6, 2023

Looks like the code assumes that the get_my_slot API would provide a string. Is that expected? I do not see the module enforcing that.

@anamehra
Copy link
Contributor Author

anamehra commented Sep 6, 2023

@abdosi , for your viz

@abdosi abdosi added the P0 Priority of the issue label Sep 6, 2023
@rlhui rlhui added the Triaged this issue has been triaged label Sep 6, 2023
@anamehra
Copy link
Contributor Author

Fixed by #396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 Priority of the issue Triaged this issue has been triaged
Projects
Archived in project
Development

No branches or pull requests

4 participants