Skip to content

Conversation

@DavidZagury
Copy link
Contributor

When PFC Watchdog or other features start collecting bulk statistics, duplicate ports can be added to the bulk stats context

Root Cause:

The addBulkStatsContext() functions did not check for duplicate VIDs before adding objects to the bulk context. The object_vids vector could contain the same VID multiple times, leading to duplicate RIDs being passed to the SAI bulk stats API.

Solution:

  1. Added object_vids_set (unordered_set) to BulkStatsContext
  2. Modified both addBulkStatsContext() overloads to check the set before adding new objects
  3. Updated removeBulkStatsContext() to maintain set consistency

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DavidZagury DavidZagury requested a review from stephenxs November 2, 2025 12:15
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@volodymyrsamotiy
Copy link
Collaborator

@kperumalbfn , could you please help to review?

auto vid = vids[i];
auto rid = rids[i];

if (ctx.object_vids_set.find(vid) != ctx.object_vids_set.end())

Choose a reason for hiding this comment

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

@DavidZagury What are the cases duplicate object-ids present in the bulk set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kperumalbfn,
We saw the duplication on a few tests such as test_pfcwd_status, test_pfcwd_interval and test_fdb

I believe there were always duplication - there is nothing stopping that from happening. But, in new version of SAI/SDK in NVIDIA switches there is a new error line regarding this.

@DavidZagury DavidZagury force-pushed the master_bulk_remove_duplicate branch from b2c4b0b to 0e5ee8a Compare December 1, 2025 17:37
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@DavidZagury DavidZagury force-pushed the master_bulk_remove_duplicate branch from 0e5ee8a to f1e81be Compare December 1, 2025 17:41
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

When PFC Watchdog or other features start collecting bulk statistics,
duplicate ports can be added to the bulk stats context

Root Cause:
-----------
The addBulkStatsContext() functions did not check for duplicate VIDs
before adding objects to the bulk context. The object_vids vector could
contain the same VID multiple times, leading to duplicate RIDs being
passed to the SAI bulk stats API.

Solution:
---------
1. Added object_vids_set (unordered_set) to BulkStatsContext
2. Modified both addBulkStatsContext() overloads to check the set before
   adding new objects
3. Updated removeBulkStatsContext() to maintain set consistency

Signed-off-by: david.zagury <[email protected]>
@DavidZagury DavidZagury force-pushed the master_bulk_remove_duplicate branch from f1e81be to ec60958 Compare December 1, 2025 17:46
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants