Skip to content

Commit

Permalink
bgpd: backpressure - Fix to avoid CPU hog
Browse files Browse the repository at this point in the history
In case when bgp_evpn_free or bgp_delete is called and the announce_list
has few items where vpn/bgp does not match, we add the item back to the
list. Because of this the list count is always > 0 thereby hogging CPU or
infinite loop.

Ticket: #3905624

Signed-off-by: Rajasekar Raja <[email protected]>
  • Loading branch information
raja-rajasekar committed May 17, 2024
1 parent e41b4a7 commit 920bf45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -6317,9 +6317,11 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn)
{
struct bgp_dest *dest = NULL;
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);

while (zebra_announce_count(&bm->zebra_announce_head)) {
while (ann_count) {
dest = zebra_announce_pop(&bm->zebra_announce_head);
ann_count--;
if (dest->za_vpn == vpn) {
bgp_path_info_unlock(dest->za_bgp_pi);
bgp_dest_unlock_node(dest);
Expand Down
4 changes: 3 additions & 1 deletion bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3908,11 +3908,13 @@ int bgp_delete(struct bgp *bgp)
int i;
struct bgp_dest *dest = NULL;
struct graceful_restart_info *gr_info;
uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head);

assert(bgp);

while (zebra_announce_count(&bm->zebra_announce_head)) {
while (ann_count) {
dest = zebra_announce_pop(&bm->zebra_announce_head);
ann_count--;
if (dest->za_bgp_pi->peer->bgp == bgp) {
bgp_path_info_unlock(dest->za_bgp_pi);
bgp_dest_unlock_node(dest);
Expand Down

0 comments on commit 920bf45

Please sign in to comment.