fix(yang-push): defer subscription updates while a schema fetch is in-flight - #35
Open
rodonile wants to merge 1 commit into
Open
fix(yang-push): defer subscription updates while a schema fetch is in-flight#35rodonile wants to merge 1 commit into
rodonile wants to merge 1 commit into
Conversation
rodonile
force-pushed
the
sub-mod-fix
branch
2 times, most recently
from
August 11, 2026 10:14
af0eeae to
94b7e8d
Compare
rodonile
force-pushed
the
sub-mod-fix
branch
2 times, most recently
from
August 13, 2026 09:57
4919ed3 to
9f24128
Compare
process_cache_response correlates responses by subscription id only. A SubscriptionModified arriving while the prior SubscriptionStarted's fetch was still in-flight caused check_subscription_new to remove the old entry (dropping buffered packets) and start a second fetch; the stale first response then clobbered the newer entry and cleared schema_fetch_pending prematurely. Defer SubscriptionStarted/SubscriptionModified like ordinary push-updates whenever a fetch is already pending, so at most one fetch is ever in-flight per subscription id. Adds subscription_update_deferred counter and a regression test.
rodonile
marked this pull request as ready for review
August 18, 2026 15:31
rodonile
enabled auto-merge (rebase)
August 18, 2026 15:32
rodonile
requested review from
riccardo-negri and
ustorbeck
and
a lite review from Copilot
August 18, 2026 15:32
There was a problem hiding this comment.
Pull request overview
This PR addresses a correctness bug in the YANG-Push validation actor where SubscriptionModified (or duplicate SubscriptionStarted) arriving while a prior schema fetch is still in-flight could clobber cache state, drop buffered packets, and potentially validate packets against the wrong schema. The fix enforces “at most one schema fetch in-flight per (peer, subscription id)” by buffering started/modified notifications while a fetch is pending, and replaying them once the pending fetch resolves.
Changes:
- Defer (
buffer)SubscriptionStarted/SubscriptionModifiednotifications whenschema_fetch_pendingis already true for the same subscription id, preventing stale cache responses from overwriting newer subscription generations. - Add a new OpenTelemetry counter
netcalyx.yang_push.validation.subscription_update.deferredto measure deferred subscription updates. - Add a regression test intended to validate correct ordering/behavior when a
SubscriptionModifiedarrives during an in-flight fetch.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+2878
to
+2882
| // Enqueue all four messages before the actor has any chance to run, so | ||
| // fetch #1 (triggered by message 1) is guaranteed to still be pending | ||
| // when messages 2-4 are handled. | ||
| udp_notif_tx | ||
| .send(make_packet(1, &started_payload)) |
ustorbeck
approved these changes
Aug 19, 2026
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.
This PR depends on #29. Issue spotted by @ustorbeck during review or #23.
Problem
A
SubscriptionModifiedarriving while the priorSubscriptionStarted's fetchwas still in-flight caused
check_subscription_newto remove the old entry(silently dropping any buffered packets) and start a second, independent fetch.
The stale first response then clobbered the newer entry and cleared
schema_fetch_pendingprematurely — packets could validate against thewrong schema or slip through unvalidated.
Fix
Defer
SubscriptionStarted/SubscriptionModifiednotifications likeordinary push-updates whenever a fetch is already pending for that
subscription id, guaranteeing at most one fetch in-flight per id. The
deferred update replays after the buffer drains, correctly triggering a
fresh fetch. Adds a
subscription_update_deferredcounter.