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

[caclmgrd] Don't crash if we find empty/null rule_props #2475

Merged
merged 2 commits into from
Jan 24, 2019
Merged

[caclmgrd] Don't crash if we find empty/null rule_props #2475

merged 2 commits into from
Jan 24, 2019

Conversation

jleveque
Copy link
Contributor

- What I did

Make caclmgrd more robust. In case we find an empty or null rule_props, don't crash, just log a warning message to the syslog.

- How to verify it

This is the old backtrace from the crash that should now be prevented:

Jan 20 14:20:11.435602 str-msn2700-06 INFO caclmgrd-start.sh[1108]: Traceback (most recent call last):
Jan 20 14:20:11.435965 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 280, in <module>
Jan 20 14:20:11.436304 str-msn2700-06 INFO caclmgrd-start.sh[1108]: main()
Jan 20 14:20:11.436631 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 276, in main
Jan 20 14:20:11.436948 str-msn2700-06 INFO caclmgrd-start.sh[1108]: caclmgr.run()
Jan 20 14:20:11.437271 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 261, in run
Jan 20 14:20:11.437590 str-msn2700-06 INFO caclmgrd-start.sh[1108]: self.config_db.listen()
Jan 20 14:20:11.437899 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/local/lib/python2.7/dist-packages/swsssdk/configdb.py", line 97, in listen
Jan 20 14:20:11.438214 str-msn2700-06 INFO caclmgrd-start.sh[1108]: self.__fire(table, row, data)
Jan 20 14:20:11.438521 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/local/lib/python2.7/dist-packages/swsssdk/configdb.py", line 82, in __fire
Jan 20 14:20:11.439440 str-msn2700-06 INFO caclmgrd-start.sh[1108]: handler(table, key, data)
Jan 20 14:20:11.439831 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 258, in <lambda>
Jan 20 14:20:11.440201 str-msn2700-06 INFO caclmgrd-start.sh[1108]: lambda table, key, data: self.notification_handler(key, data))
Jan 20 14:20:11.440569 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 248, in notification_handler
Jan 20 14:20:11.440935 str-msn2700-06 INFO caclmgrd-start.sh[1108]: self.update_control_plane_acls()
Jan 20 14:20:11.443090 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 238, in update_control_plane_acls
Jan 20 14:20:11.443506 str-msn2700-06 INFO caclmgrd-start.sh[1108]: iptables_cmds = self.get_acl_rules_and_translate_to_iptables_commands()
Jan 20 14:20:11.443887 str-msn2700-06 INFO caclmgrd-start.sh[1108]: File "/usr/bin/caclmgrd", line 160, in get_acl_rules_and_translate_to_iptables_commands
Jan 20 14:20:11.444263 str-msn2700-06 INFO caclmgrd-start.sh[1108]: acl_rules[rule_props["PRIORITY"]] = rule_props
Jan 20 14:20:11.444642 str-msn2700-06 INFO caclmgrd-start.sh[1108]: KeyError: 'PRIORITY'
Jan 20 14:20:11.453502 str-msn2700-06 NOTICE systemd[1]: caclmgrd.service: main process exited, code=exited, status=1/FAILURE

In its place, this is the new output to the syslog:

Jan 22 23:37:11.250132 str-msn2700-06 WARNING caclmgrd: rule_props for rule_id RULE_1 empty or null!

Copy link
Collaborator

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@lguohan lguohan merged commit 116ddb9 into sonic-net:master Jan 24, 2019
@jleveque jleveque deleted the caclmgrd_fix branch January 24, 2019 07:55
lguohan pushed a commit to lguohan/sonic-buildimage that referenced this pull request Jan 25, 2019
* [caclmgrd] Don't crash if we find empty/null rule_props
@yxieca
Copy link
Contributor

yxieca commented Jan 25, 2019

Made to 201811 branch on 1/25/2019

yxieca pushed a commit that referenced this pull request Jan 25, 2019
* [caclmgrd] Don't crash if we find empty/null rule_props
yxieca added a commit to yxieca/sonic-buildimage that referenced this pull request Oct 4, 2022
…bmodule head

linkmgrd:
* 44f182b 2022-10-03 | [Active-Standby] fix syslog flood caused by `unkown -> standby` switchovers  (sonic-net#137) (HEAD -> 202205) [Jing Zhang]
* 9284ce1 2022-09-26 | [Active-Active] avoid being stuck in `unknown` after process init (sonic-net#136) [Jing Zhang]
* 55711d7 2022-09-16 | Install libyang to azure pipeline (sonic-net#132) [Hua Liu]

swss:
* 2f7da1e 2022-09-30 | [build] add missing package libyang-dev in lgtm.yml (sonic-net#2475) (HEAD -> 202205, github/202205) [Qi Luo]

platform-daemon:
* 5b96170 2022-09-23 | add support to execute new ycable API's, add datetime field to mux_info (sonic-net#297) (HEAD -> 202205) [vdahiya12]

platform-common:
* de1bd8e 2022-09-28 | Remove shell=True (sonic-net#313) (HEAD -> 202205) [Mai Bui]
* 77760bf 2022-09-23 | [credo][ycable] remove mux-toggle inprogress flags for some API's (sonic-net#311) [vdahiya12]

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
theasianpianist added a commit to theasianpianist/sonic-buildimage that referenced this pull request Oct 5, 2022
Include:

df92fb7 Improve verbosity level and provide more info in the log (sonic-net#2472)
e81ed20 [intfmgr]: Enable `accept_untracked_na` kernel param (sonic-net#2436)
24d29f1 [orchdaemon]: Fixed sairedis record file rotation (sonic-net#2299)
b8ee07d [build] add missing package libyang-dev in lgtm.yml (sonic-net#2475)
e46dd29 [crm] Fix issue with continues EXCEEDED and CLEAR logs for ACL group/table counters (sonic-net#2463)
b61d24c [doc]: Update README.md (sonic-net#2456)
b9ade5d [orchagent] Fix issue: ip prefix shall be inited even if VRF/VNET is not ready (sonic-net#2461)
f0f1eb4 Revert "[counters] Improve performance by polling only configured ports buffer queue/pg counters (sonic-net#2360)" (sonic-net#2458)
3d757a8 [ci][asan] add DVS tests run with ASAN (sonic-net#2441)
04fbc8e [ci] Only when test stage succeeded or succeededwithissues, PR run Gcov (sonic-net#2460)
7cc035f [orchagent]: Publish identified events via structured-events channel (sonic-net#2446)
efa0f01 [QoS] Enforce drop probability only for colors whose WRED are enabled (sonic-net#2422)
05c5c2f [swss] Replace memset functions (sonic-net#2423)
9ff993d Modified the test file to remove click commands and do the REDIS-DB u… (sonic-net#2264)
9e376af Install libyang in azure pipeline. (sonic-net#2445)
c1eb99a check state_db for po before sending ARP/ND pkts (sonic-net#2444)
43cc486 [portmgr] Fixed the orchagent crash due to late arrival of notif (sonic-net#2431)
b62c716 Enhance orchagent and buffer manager in error handling (sonic-net#2414)
13bda3c [Everflow/ERSPAN] Set correct destination port and mac address when the nexthop is updated for ERSPAN mirror destination (sonic-net#2392)
0ccb315 Revert "[VS Test] Skip failing subport tests (sonic-net#2370)" (sonic-net#2421)
ac8a83f [UT] [Portsyncd] Added Unit Tests for portsyncd (sonic-net#2297)
83a186a Change the log messages in addKernelNeigh/Route from ERROR to INFO (sonic-net#2437)
9c23389 [BFD]Clean up state_db BFD entries on swss restart (sonic-net#2434)
d41aebf EntityBulker SIGSEGV when create_entry attr_count 0 (sonic-net#2224)
f52a7b1 Fix the Fec Mode Setting of gbsyncd (sonic-net#2430)
8cc0a45 [neighsyncd] Enabling ipv4 link local entries for non-dualtor (sonic-net#2427)
5624e87 Revert "[ci][asan] add DVS tests run with ASAN (sonic-net#2363)" (sonic-net#2433)
a26b26a Dynamic port configuration - add port buffer cfg to the port ref counter (sonic-net#2194)
486939a tlm_teamd: Filter portchannel subinterface events from STATE_DB LAG_TABLE (sonic-net#2408)
a4b8992 [counters] Improve performance by polling only configured ports buffer queue/pg counters (sonic-net#2360)
4aaeec9 added support for Xsight platform (sonic-net#2426)
ca9edca [ci][asan] add DVS tests run with ASAN (sonic-net#2363)
dec4570 Handle dual ToR neighbor miss scenario (sonic-net#2151)
9eb4422 Upstream new development on p4orch (sonic-net#2237)
e9be2c0 [lgtm] Fix dependency (sonic-net#2419)
c0168f3 [muxorch] Returning true if nbr in skip_neighbor_ in isNeighborActive() (sonic-net#2415)
cfcf3d8 [macsec]: Set MTU for MACsec (sonic-net#2398)
8346034 Delete Invalid if condition in intfsorch.cpp (sonic-net#2411)

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
yxieca added a commit that referenced this pull request Oct 6, 2022
…bmodule head (#12264)

linkmgrd:
* 44f182b 2022-10-03 | [Active-Standby] fix syslog flood caused by `unkown -> standby` switchovers  (#137) (HEAD -> 202205) [Jing Zhang]
* 9284ce1 2022-09-26 | [Active-Active] avoid being stuck in `unknown` after process init (#136) [Jing Zhang]
* 55711d7 2022-09-16 | Install libyang to azure pipeline (#132) [Hua Liu]

swss:
* 2f7da1e 2022-09-30 | [build] add missing package libyang-dev in lgtm.yml (#2475) (HEAD -> 202205, github/202205) [Qi Luo]

platform-daemon:
* 5b96170 2022-09-23 | add support to execute new ycable API's, add datetime field to mux_info (#297) (HEAD -> 202205) [vdahiya12]

platform-common:
* de1bd8e 2022-09-28 | Remove shell=True (#313) (HEAD -> 202205) [Mai Bui]
* 77760bf 2022-09-23 | [credo][ycable] remove mux-toggle inprogress flags for some API's (#311) [vdahiya12]

Signed-off-by: Ying Xie <ying.xie@microsoft.com>

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
theasianpianist added a commit that referenced this pull request Oct 7, 2022
Include:

df92fb7 Improve verbosity level and provide more info in the log (#2472)
e81ed20 [intfmgr]: Enable `accept_untracked_na` kernel param (#2436)
24d29f1 [orchdaemon]: Fixed sairedis record file rotation (#2299)
b8ee07d [build] add missing package libyang-dev in lgtm.yml (#2475)
e46dd29 [crm] Fix issue with continues EXCEEDED and CLEAR logs for ACL group/table counters (#2463)
b61d24c [doc]: Update README.md (#2456)
b9ade5d [orchagent] Fix issue: ip prefix shall be inited even if VRF/VNET is not ready (#2461)
f0f1eb4 Revert "[counters] Improve performance by polling only configured ports buffer queue/pg counters (#2360)" (#2458)
3d757a8 [ci][asan] add DVS tests run with ASAN (#2441)
04fbc8e [ci] Only when test stage succeeded or succeededwithissues, PR run Gcov (#2460)
7cc035f [orchagent]: Publish identified events via structured-events channel (#2446)
efa0f01 [QoS] Enforce drop probability only for colors whose WRED are enabled (#2422)
05c5c2f [swss] Replace memset functions (#2423)
9ff993d Modified the test file to remove click commands and do the REDIS-DB u… (#2264)
9e376af Install libyang in azure pipeline. (#2445)
c1eb99a check state_db for po before sending ARP/ND pkts (#2444)
43cc486 [portmgr] Fixed the orchagent crash due to late arrival of notif (#2431)
b62c716 Enhance orchagent and buffer manager in error handling (#2414)
13bda3c [Everflow/ERSPAN] Set correct destination port and mac address when the nexthop is updated for ERSPAN mirror destination (#2392)
0ccb315 Revert "[VS Test] Skip failing subport tests (#2370)" (#2421)
ac8a83f [UT] [Portsyncd] Added Unit Tests for portsyncd (#2297)
83a186a Change the log messages in addKernelNeigh/Route from ERROR to INFO (#2437)
9c23389 [BFD]Clean up state_db BFD entries on swss restart (#2434)
d41aebf EntityBulker SIGSEGV when create_entry attr_count 0 (#2224)
f52a7b1 Fix the Fec Mode Setting of gbsyncd (#2430)
8cc0a45 [neighsyncd] Enabling ipv4 link local entries for non-dualtor (#2427)
5624e87 Revert "[ci][asan] add DVS tests run with ASAN (#2363)" (#2433)
a26b26a Dynamic port configuration - add port buffer cfg to the port ref counter (#2194)
486939a tlm_teamd: Filter portchannel subinterface events from STATE_DB LAG_TABLE (#2408)
a4b8992 [counters] Improve performance by polling only configured ports buffer queue/pg counters (#2360)
4aaeec9 added support for Xsight platform (#2426)
ca9edca [ci][asan] add DVS tests run with ASAN (#2363)
dec4570 Handle dual ToR neighbor miss scenario (#2151)
9eb4422 Upstream new development on p4orch (#2237)
e9be2c0 [lgtm] Fix dependency (#2419)
c0168f3 [muxorch] Returning true if nbr in skip_neighbor_ in isNeighborActive() (#2415)
cfcf3d8 [macsec]: Set MTU for MACsec (#2398)
8346034 Delete Invalid if condition in intfsorch.cpp (#2411)

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
tshalvi pushed a commit to tshalvi/sonic-buildimage that referenced this pull request Dec 20, 2022
**Why I did it**
lgtm build process broken. This PR will fix it.
```
[2022-09-30 18:21:33] [build-stderr] In file included from defaultvalueprovider.cpp:10:
[2022-09-30 18:21:33] [build-stderr] defaultvalueprovider.h:8:10: fatal error: libyang/libyang.h: No such file or directory
[2022-09-30 18:21:33] [build-stderr]     8 | #include <libyang/libyang.h>
[2022-09-30 18:21:33] [build-stderr]       |          ^~~~~~~~~~~~~~~~~~~
[2022-09-30 18:21:33] [build-stderr] compilation terminated.
```

**How I verified it**
The lgtm.yml change does not take effect in this PR's checker. I manually test it https://lgtm.com/logs/19f4015aec3863d7d4e7d5667cbbc251efd1d0f4/lang:cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants