[intfsorch]: Retry loopback action update failures#4766
Conversation
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR improves IntfsOrch’s handling of loopback_action updates from APP_INTF_TABLE: it preserves SET tasks in the consumer queue when a retryable SAI failure occurs while updating the RIF loopback packet action, and it treats invalid loopback_action values as a logged no-op so other fields in the same SET can still be applied.
Changes:
- Validate
loopback_actionearly inIntfsOrch::doTask()and ignore invalid values (viagetSaiLoopbackAction()warning + skipping the field). - If setting the RIF loopback action fails in a retryable way, keep the
SETinm_toSyncso it will be retried on the next drain. - Add mock unit tests covering (1) retry behavior on SAI set failure and (2) ignoring invalid
loopback_actionwhile still applying other fields (e.g., MTU).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
orchagent/intfsorch.cpp |
Adds loopback_action validation and retry behavior so requested loopback action updates aren’t lost on retryable SAI errors. |
tests/mock_tests/intfsorch_ut.cpp |
Adds unit tests to verify retry-on-failure and ignore-invalid-field behavior for loopback_action. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azpw run |
|
Retrying failed(or canceled) jobs... |
|
Retrying failed(or canceled) stages in build 1169337: ✅Stage TestAsan:
✅Stage Test:
|
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
tests/mock_tests/intfsorch_ut.cpp:523
dynamic_cast<Consumer*>may return nullptr; this test dereferencesconsumerimmediately, which would crash the test if the executor lookup ever changes. Add an assertion (orASSERT_NE) before usingconsumer.
auto consumer = dynamic_cast<Consumer *>(gIntfsOrch->getExecutor(APP_INTF_TABLE_NAME));
ASSERT_NE(consumer, nullptr);
tests/mock_tests/intfsorch_ut.cpp:549
dynamic_cast<Consumer*>may return nullptr; this test dereferencesconsumerimmediately, which would crash the test if the executor lookup ever changes. Add an assertion (orASSERT_NE) before usingconsumer.
};
auto consumer = dynamic_cast<Consumer *>(gIntfsOrch->getExecutor(APP_INTF_TABLE_NAME));
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6b568a1-5d2a-4309-b1ac-ef21ca155079 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
tests/mock_tests/intfsorch_ut.cpp:57
- The new
_ut_set_router_interface_attribute()stub returnsSAI_STATUS_SUCCESSfor every non-loopback attribute, which can unintentionally mask failures and alter behavior for other tests in this suite (e.g., MAC/MTU/MPLS/NAT-zone attribute sets). Consider delegating to the original SAIset_router_interface_attributeimplementation for attributes you are not explicitly testing, and only intercepting/failing the loopback-action attribute.
return SAI_STATUS_SUCCESS;
}
Delegate non-loopback router-interface attribute updates to the original SAI implementation so the retry hook does not mask other unit-test behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6b568a1-5d2a-4309-b1ac-ef21ca155079 Signed-off-by: Xichen96 <lukelin0907@gmail.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
This PR has backport request label(s) for branch(es): 202605, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202605: <test result>) in the Test result section as well in your PR description. ---Powered by SONiC BuildBot
|
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
What I did
Fixed
IntfsOrchhandling ofloopback_actionupdates for an existing router interface.Root cause
IntfsOrch::doTask()calledsetIntfLoopbackAction()but ignored its return value. The helper already returnsfalsewhen SAI handling reportstask_need_retry, but the caller continued to the finalm_toSync.erase(). A transient SAI failure therefore discarded the desired action instead of retaining it for another drain.An unsupported value such as
loopback_action=invalidis different: it is permanent invalid input and must not retain the entire interfaceSETforever.Fix
The new flow is:
This preserves SWSS retry behavior without letting one invalid field block unrelated valid updates in the same APP_DB row.
Why I did it
A transient SAI resource condition must not silently lose desired state. Conversely, this update must remain usable:
The invalid action is ignored, while the valid NAT-zone update still converges.
This issue is independent of the interface-removal and VRF-rehome state machines in PRs #4746 and #4764. The branch has been restacked on current
master, preserving merged PR #4758 and its regression coverage.How I verified it
Focused mock coverage in
tests/mock_tests/intfsorch_ut.cppverifies:IntfsOrchRetriesLoopbackActionSetFailureSAI_STATUS_INSUFFICIENT_RESOURCESresult for the loopback-action attribute;m_toSync;SAI_PACKET_ACTION_DROPis applied.IntfsOrchIgnoresInvalidLoopbackActionFieldnat_zone=7;SAI_ROUTER_INTERFACE_ATTR_LOOPBACK_PACKET_ACTION, so another RIF attribute update cannot consume the injected failure.Current exact-head master PR build
a6d671f713779bb42824c99425af6d1a7f616cc6Prior pre-restack evidence
8e4b4c2df00601c5585a6a986f80d95f8ee4d418Test vstest, andTestAsan vstestlanes passed.That build is useful implementation evidence, but the current restacked head requires its own completed result.
202605 PR-build validation
202605stack contains merged PR [intfsorch]Fix race condition between VRF bind and ip address removal #4758 followed by [intfsorch]: Fence new RIF dependencies during interface removal #4746, this PR, [neighorch]: Track remote next hops on inband RIF #4769, [neighorch]: Avoid inserting missing bulk neighbors #4772, [intfsorch]: Retry explicit router interface VRF rehome #4764, and [neighorch]: Retry until inband port is available #4770.d4b0502ecdac76d56fdf063a633045c0fb0de977Tested for 202605 branchlabel must remain absent until that exact result is complete.Details if related
orchagent/intfsorch.cpptests/mock_tests/intfsorch_ut.cpp