[portsyncd]: Add default catch block in portsyncd#1033
Merged
stcheng merged 4 commits intosonic-net:masterfrom Aug 22, 2019
Merged
[portsyncd]: Add default catch block in portsyncd#1033stcheng merged 4 commits intosonic-net:masterfrom
stcheng merged 4 commits intosonic-net:masterfrom
Conversation
jleveque
approved these changes
Aug 19, 2019
kcudnik
approved these changes
Aug 19, 2019
jleveque
approved these changes
Aug 19, 2019
stcheng
approved these changes
Aug 19, 2019
kcudnik
approved these changes
Aug 20, 2019
Contributor
|
Can we also fix the code that does not seem to throw appropriately? |
renukamanavalan
approved these changes
Aug 21, 2019
yxieca
pushed a commit
that referenced
this pull request
Aug 26, 2019
* Add default catch block in portsyncd * Updated error message with the right spelling * Update try block to throw exception of type runtime_error * Remove additional paranthesis in throw statement
Janetxxx
pushed a commit
to Janetxxx/sonic-swss
that referenced
this pull request
Nov 10, 2025
* Add default catch block in portsyncd * Updated error message with the right spelling * Update try block to throw exception of type runtime_error * Remove additional paranthesis in throw statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Added a default catch block in portsyncd code as current catch block only accepts parameter of type Exception. In the throw currently, a const char * is passed which leads to a core dumped scenario.
Why I did it
Added a default catch block.
How I verified it
To test, Build a sonic-Broadcom image.
Loaded the image in a DUT, rebooted the DUT without a minigraph.xml or config_db.json in /etc/sonic.
While booting up, when systemd tries to start portsyncd process, it passes the parameter port_config.ini. The right port_config.ini is selected and placed in the right directory in swss docker before starting portsyncd process. The right port_config.ini is selected based HW SKU and platform type which is obtained from DEVICE_METADATA. If the device configuration is not loaded correctly, then DEVICE_METADATA will not be read, and port_config.ini is not picked up. With this, if portsyncd is started without the right port_config.ini, the portsyncd process will throw and exception.
Before the fix error looked like:
<14>Aug 5 22:20:40 MWH01-0101-0334-13T0 supervisord: portsyncd terminate called after throwing an instance of 'char const*'
<30>Aug 5 22:20:40 MWH01-0101-0334-13T0 swss.sh[1901]: 2019-08-05 22:20:40,806 INFO exited: portsyncd (terminated by SIGABRT (core dumped); not expected)
After fix the error will look like:
Aug 14 23:24:55.845720 sonic INFO supervisord: portsyncd Exception had been thrown in deamon
Details if related