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

handle json load exception in bgpmon #17856

Conversation

lipxu
Copy link
Contributor

@lipxu lipxu commented Jan 19, 2024

Why I did it

ICM reported due to "BGPMon Process exited" which was caused by json load exception.

Work item tracking
  • Microsoft ADO (number only):
    25916773

How I did it

Add an exception handle during json load.

How to verify it

Verified locally, add debug log to modify the output string of cmd to make it not with json formation, then check the syslog.

Jan 19 03:09:56.275058 str3-7060-acs-1 INFO tmp.py: bgpmon service started
Jan 19 03:09:56.571696 str3-7060-acs-1 WARNING tmp.py: WARNING JSONDecodeError: Expecting ':' delimiter: line 109 column 12 (char 2203) when execute: ['vtysh', '-c', 'show bgp summary json'] Retry attempt: 1
Jan 19 03:09:57.891086 str3-7060-acs-1 WARNING tmp.py: WARNING JSONDecodeError: Expecting ':' delimiter: line 109 column 12 (char 2203) when execute: ['vtysh', '-c', 'show bgp summary json'] Retry attempt: 2
Jan 19 03:09:59.229662 str3-7060-acs-1 WARNING tmp.py: WARNING JSONDecodeError: Expecting ':' delimiter: line 109 column 12 (char 2203) when execute: ['vtysh', '-c', 'show bgp summary json'] Retry attempt: 3
Jan 19 03:10:00.231532 str3-7060-acs-1 ERR tmp.py: ERROR Maximum retry attempts reached. Failed to execute: ['vtysh', '-c', 'show bgp summary json'] Output: {#12"ipv4Unicast":{#12 "routerId":"10.1.0.32{#12"ipv4Unicast":{#12 "routerId":"10.1.0.32",#12 "as":65100,#12 "vrfId":0,#12 "vrfName":"default",#12 "tableVersion":6,#12 "ribCount":3,#12 "ribMemory":576,#12 "peerCount":4,#12 "peerMemory":2967904,#12 "peerGroupCount":4,#12 "peerGroupMemory":256,#12 "peers":{#12 "10.0.0.57":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA01T1",#12 "idType":"ipv4"#12 },#12 "10.0.0.59":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA02T1",#12 "idType":"ipv4"#12 },#12 "10.0.0.61":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA03T1",#12 "idType":"ipv4"#12 },#12 "10.0.0.63":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA04T1",#12 "idType":"ipv4"#12 }#12 },#12 "failedPeers":4,#12 "displayedPeers":4,#12 "totalPeers":4,#12 "dynamicPeers":0,#12 "bestPath":{#12 "multiPathRelax":"true"#12 }#12}#12,#12"ipv6Unicast":{#12 "routerId":"10.1.0.32",#12 "as":65100,#12 "vrfId":0,#12 "vrfName"error"default",#12 "tableVersion":6,#12 "ribCount":3,#12 "ribMemory":576,#12 "peerCount":4,#12 "peerMemory":2967904,#12 "peerGroupCount":4,#12 "peerGroupMemory":256,#12 "peers":{#12 "fc00::72":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA01T1",#12 "idType":"ipv6"#12 },#12 "fc00::76":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA02T1",#12 "idType":"ipv6"#12 },#12 "fc00::7a":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA03T1",#12 "idType":"ipv6"#12 },#12 "fc00::7e":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA04T1",#12 "idType":"ipv6"#12 }#12 },#12 "failedPeers":4,#12 "displayedPeers":4,#12 "totalPeers":4,#12 "dynamicPeers":0,#12 "bestPath":{#12 "multiPathRelax":"true"#12 }#12}#12}",#12 "as":65100,#12 "vrfId":0,#12 "vrfName":"default",#12 "tableVersion":6,#12 "ribCount":3,#12 "ribMemory":576,#12 "peerCount":4,#12 "peerMemory":2967904,#12 "peerGroupCount":4,#12 "peerGroupMemory":256,#12 "peers":{#12 "10.0.0.57":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA01T1",#12 "idType":"ipv4"#12 },#12 "10.0.0.59":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA02T1",#12 "idType":"ipv4"#12 },#12 "10.0.0.61":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA03T1",#12 "idType":"ipv4"#12 },#12 "10.0.0.63":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA04T1",#12 "idType":"ipv4"#12 }#12 },#12 "failedPeers":4,#12 "displayedPeers":4,#12 "totalPeers":4,#12 "dynamicPeers":0,#12 "bestPath":{#12 "multiPathRelax":"true"#12 }#12}#12,#12"ipv6Unicast":{#12 "routerId":"10.1.0.32",#12 "as":65100,#12 "vrfId":0,#12 "vrfName"error"default",#12 "tableVersion":6,#12 "ribCount":3,#12 "ribMemory":576,#12 "peerCount":4,#12 "peerMemory":2967904,#12 "peerGroupCount":4,#12 "peerGroupMemory":256,#12 "peers":{#12 "fc00::72":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA01T1",#12 "idType":"ipv6"#12 },#12 "fc00::76":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA02T1",#12 "idType":"ipv6"#12 },#12 "fc00::7a":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA03T1",#12 "idType":"ipv6"#12 },#12 "fc00::7e":{#12 "remoteAs":64600,#12 "localAs":65100,#12 "version":4,#12 "msgRcvd":0,#12 "msgSent":0,#12 "tableVersion":0,#12 "outq":0,#12 "inq":0,#12 "peerUptime":"never",#12 "peerUptimeMsec":0,#12 "pfxRcd":0,#12 "pfxSnt":0,#12 "state":"Active",#12 "peerState":"OK",#12 "connectionsEstablished":0,#12 "connectionsDropped":0,#12 "desc":"ARISTA04T1",#12 "idType":"ipv6"#12 }#12 },#12 "failedPeers":4,#12 "displayedPeers":4,#12 "totalPeers":4,#12 "dynamicPeers":0,#12 "bestPath":{#12 "multiPathRelax":"true"#12 }#12}#12}

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: xuliping <xuliping@microsoft.com>
Signed-off-by: xuliping <xuliping@microsoft.com>
Copy link
Contributor

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit c23c8af into sonic-net:master Jan 29, 2024
19 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Feb 2, 2024
Why I did it
ICM reported due to "BGPMon Process exited" which was caused by json load exception.

Work item tracking
Microsoft ADO (number only):
25916773
How I did it
Add an exception handle during json load.

How to verify it
Verified locally, add debug log to modify the output string of cmd to make it not with json formation, then check the syslog.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #18005

mssonicbld pushed a commit that referenced this pull request Feb 3, 2024
Why I did it
ICM reported due to "BGPMon Process exited" which was caused by json load exception.

Work item tracking
Microsoft ADO (number only):
25916773
How I did it
Add an exception handle during json load.

How to verify it
Verified locally, add debug log to modify the output string of cmd to make it not with json formation, then check the syslog.
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Feb 24, 2024
Why I did it
ICM reported due to "BGPMon Process exited" which was caused by json load exception.

Work item tracking
Microsoft ADO (number only):
25916773
How I did it
Add an exception handle during json load.

How to verify it
Verified locally, add debug log to modify the output string of cmd to make it not with json formation, then check the syslog.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202305: #18173

mssonicbld pushed a commit that referenced this pull request Feb 26, 2024
Why I did it
ICM reported due to "BGPMon Process exited" which was caused by json load exception.

Work item tracking
Microsoft ADO (number only):
25916773
How I did it
Add an exception handle during json load.

How to verify it
Verified locally, add debug log to modify the output string of cmd to make it not with json formation, then check the syslog.
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