Repository navigation
Conversation
Signed-off-by: Seshagirirao Lekkala <selekkal@cisco.com>
vasantspatil
self-requested a review
November 4, 2026 23:38
vasantspatil
approved these changes
Nov 4, 2026
vasantspatil
approved these changes
Nov 4, 2026
This branch has not been deployed
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.
Pre-submission checklist
git diff --checkpre-commit runSummary
Removing an FBOSS load balancer can leave its SAI hash object attached to the switch on ASICs that do not support
SAI_HASH_FIELDS_CLEAR_BEFORE_SET. The subsequentSaiHashrelease then removes an object that SAI still considers referenced, which can fail withOBJECT_IN_USEand crash the SW agent during load-balancer removal.This PR detaches ECMP and LAG hash objects unconditionally before releasing their owning references and adds a regression test for the unsupported-feature case.
Root Cause
SaiSwitchManager::removeLoadBalancer()usedresetLoadBalancer()to clear the switch hash attributes.resetLoadBalancer()is intentionally gated byHwAsic::Feature::SAI_HASH_FIELDS_CLEAR_BEFORE_SET, because it was introduced as a workaround for replacing hash fields on selected SAI implementations.On GR2, that feature is unsupported. The switch therefore continued to reference the old hash object while
ecmpV[46]Hash_orlagV[46]Hash_was reset. SAI object lifetime ordering was violated: the hash object was released before the switch reference was cleared.Fix
detachLoadBalancer<HashAttrT>()helper that writesSAI_NULL_OBJECT_IDto the switch hash attribute.removeLoadBalancer()before resetting the correspondingshared_ptr.resetLoadBalancer()feature-gated for its original hash-field replacement workaround; this change does not alter add/update programming behavior.Test Plan
SaiHashDetachTest.removeLoadBalancerDetachesHashesBeforeRelease.SAI_HASH_FIELDS_CLEAR_BEFORE_SETdisabled.git diff --checkpassed.The focused Buck2 test could not be executed in this checkout because its generated external-cell configuration is not present; the test is included for mainline CI.