Skip to content

[202605][intfsorch]Fix race condition between VRF bind and ip address removal#4778

Open
dgsudharsan wants to merge 2 commits into
sonic-net:202605from
dgsudharsan:vrf_fix_2605
Open

[202605][intfsorch]Fix race condition between VRF bind and ip address removal#4778
dgsudharsan wants to merge 2 commits into
sonic-net:202605from
dgsudharsan:vrf_fix_2605

Conversation

@dgsudharsan

Copy link
Copy Markdown
Collaborator

Manual cherry-pick of #4758

Why I did it

When loopback IP removal and VRF rebind arrive in the same m_toSync batch, the bare
interface key is processed before per-IP keys. The VRF bind is attempted while IPs remain,
logged as an error, and dropped, leaving the interface stuck in the wrong VRF.

Work item tracking
  • Microsoft ADO (number only): N/A

How I did it

  • orchagent/intfsorch.cpp: Defer VRF bind (retain sync entry) instead of error+log+drop
    when IPs are still present on the interface.
  • tests/mock_tests/intfsorch_ut.cpp: Add IntfsOrchVrfBindDeferredUntilIpRemoved
    regression test for the batched IP-removal + VRF-bind race (Redmine #5108427).

How to verify it

  • Run mock UT IntfsOrchVrfBindDeferredUntilIpRemoved in intfsorch_ut.cpp.

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

  • 201811
  • 201911
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411

Description for the changelog

[intfsorch]Fix race condition between VRF bind and ip address removal

Summary by CodeRabbit

  • Bug Fixes
    • Improved loopback interface VRF reassignment when IP address changes are still pending.
    • VRF reassignment is now deferred until pending IP removals complete, preventing the update from being dropped.
    • Added a regression test covering the batched “interface IP removal + VRF rebind” race to ensure correct post-drain behavior.

… removal (sonic-net#4758)

* [intfsorch]Fix race condition between VRF bind and ip address removal

Signed-off-by: dgsudharsan <sudharsand@nvidia.com>

* Changing log level as per review feedback

Signed-off-by: dgsudharsan <sudharsand@nvidia.com>

---------

Signed-off-by: dgsudharsan <sudharsand@nvidia.com>
@dgsudharsan
dgsudharsan requested a review from prsunny as a code owner July 21, 2026 23:33
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@dgsudharsan dgsudharsan added the Tested for 202605 branch Tested for 202605 branch label Jul 21, 2026
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
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

Tested for 202605 branch Tested for 202605 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants