Skip to content

fix(udmd,nefd): the AMF leg lapses with its EE subscription, a shortened grant is reported, a lapsed DELETE is 404, the sweep is per AMF (#2149) - #2155

Merged
parlakisik merged 3 commits into
mainfrom
b2-2149-udmd-ee-expiry-followups
Nov 20, 2026
Merged

parlakisik merged 3 commits into
mainfrom
b2-2149-udmd-ee-expiry-followups

Conversation

@parlakisik

Copy link
Copy Markdown
Contributor

Closes #2149.

These are R42's four follow-ups from the #2144 review (udmd EE subscriptions lapse at their granted expiry). This branch has main merged in, including #2123.

Verified against main (#2144 merged)

Item On main
1. The AMF leg has no expiry True. ee_amf::subscribe_body sends no options, and a refreshed expiry never reaches the leg
2. A 204 hides a shortened grant True. ee_grant_expiry caps the expiry and the modify answers 204
3. A DELETE of a lapsed subscription is 204 True. The unsubscribe path does not check is_expired; modify does
4. The sweep releases legs one at a time True: for sub in &expired { release(sub).await }

TS 29.503's UpdateEeSubscription answers 200 with a TS 29.571 PatchResult, or 204. PatchResult (report: [ReportItem {path, reason}]) is the only body the spec defines for a 200. So a shortened grant is reported as the ReportItem for /reportingOptions/expiry, with reason: "granted <DateTime>".

Changes

  1. The AMF leg's expiry. subscribe_body adds options: {trigger: CONTINUOUS, expiry} (AmfEventMode, where trigger is mandatory) when the subscription has an expiry, and AmfEeLeg.expiry records it. When a leg already fits at the serving AMF but its expiry differs, the reconcile sends Namf_EventExposure modify replace /options/expiry and keeps the same AMF subscription. If the AMF does not take it, or the expiry was removed (an option item cannot remove one), the leg is replaced by a fresh subscribe, as before.
  2. The 200 answer. It is used only when the granted expiry is earlier than the one asked for; otherwise the answer is 204. nefd's confirmed_expiry reads the PatchResult form, so a refreshing nefd records the real expiry.
  3. DELETE of a lapsed subscription. It is removed, its AMF leg is released on its own task (Cancellation-unsafe side effects in nefd, udmd, pcfd and lmfd #1877), and the answer is 404.
  4. The sweep. Legs are grouped by the AMF that holds them. Up to 8 AMFs are released at once, each in turn. An AMF that fails one release has its remaining legs parked for the unsubscribe reconciler without another request.
  5. Docs: udm.md.

Acceptance vs evidence (each revert done on its own, restored, and checked with diff)

Item Test Revert, and what fails
1 the_amf_leg_lapses_with_its_ee_subscription_2149, against the real amfd. The leg's AMF subscription expires at the granted time. A refresh moves it on the same AMF subscription, and there is no second one No options: fails at "the AMF leg lapses with it". Expiry change ignored by the reconcile: fails at the moved leg expiry
2 an_ee_subscription_lapses_at_its_granted_expiry_2125, updated: a capped refresh answers 200 with exactly that PatchResult, and an uncapped one answers 204. nefd a_udm_patch_result_reports_the_granted_expiry_2149 Always 204: the 2125 test fails. nefd's PatchResult arm removed: the nefd test fails
3 The same 2125 test: a DELETE after the expiry answers 404, removes the subscription, and deletes its AMF leg once. The sweep then finds nothing The lapsed check removed: fails at "a DELETE after the expiry finds it gone"
4 the_expiry_sweep_releases_per_amf_in_parallel_2149: two blackholed AMFs with 2 legs each, and a healthy one with 1. The sweep takes less than 2 call timeouts, the healthy leg is deleted, and 4 legs are parked One AMF at a time: fails at "about one call timeout". A failed AMF retried for each leg: fails the same way

Gates (local)

…ned grant is reported, a lapsed DELETE is 404, the sweep is per AMF (#2149)

R42 on #2144:
- udmd's Namf_EventExposure subscription toward the AMF now carries the
  Nudm_EE subscription's granted expiry (`options.expiry`, TS 29.518
  AmfEventMode). A refresh moves it by Namf modify (`replace
  /options/expiry`), so the AMF leg lapses with the subscription, even
  across a UDM restart.
- A PATCH whose expiry the UDM shortened answers 200 with a TS 29.571
  PatchResult (TS 29.503's UpdateEeSubscription 200 body). Its ReportItem
  is `/reportingOptions/expiry`, reason `granted <DateTime>`. nefd reads it
  as the confirmed expiry.
- A DELETE of a lapsed subscription answers 404, as a modify does, and
  releases its AMF leg at once.
- The expiry sweep releases legs per AMF, up to 8 AMFs at once. An AMF that
  fails one release has its other legs parked for the unsubscribe
  reconciler (the #2128 shape).

Spec: specs/udmd-ee-expiry-followups-2149.md
Spec: specs/udmd-ee-expiry-followups-2149.md
@parlakisik

Copy link
Copy Markdown
Contributor Author

R42 review: #2155 (head cb0e889, Closes #2149)

Tested on cb0e889 merged with origin/main, and then with #2152's head (b4607e9) merged locally (not pushed). cargo test -p nextgcore-nefd -p nextgcore-udmd passes on all 8 result lines (340 tests) on that combined tree.

Merge order: needs merge after #2152, or a rebase after it. The two conflict textually in nefd/src/main.rs, and only there. The conflict is two tests added at the same point: #2152's a_subscription_the_nef_removes_is_cancelled_at_the_af_2133 and this PR's a_udm_patch_result_reports_the_granted_expiry_2149. Keeping both resolves it, and udmd app.rs auto-merges. Semantically they fit: #2152 makes nefd send add /reportingOptions/expiry, and this PR's asked/granted are read from the post-patch body, so the member form and the object form both get the 200 PatchResult when the grant is capped.

Verified. Each revert below was a behavioural edit on the combined tree, run on its own; I restored each and the tree is clean.

  1. The AMF leg's expiry (TS 29.518 AmfEventMode, trigger CONTINUOUS). subscribe_body puts options.expiry on the leg.
    • No options: the_amf_leg_lapses_with_its_ee_subscription_2149 fails at "the AMF leg lapses with it".
    • A refresh moves the leg with replace /options/expiry on the same AMF subscription. Reconcile ignoring an expiry change: the same test fails at the moved expiry (ee_amf.rs:2006).
  2. Shortened grant answered 200 with a PatchResult. Always 204: an_ee_subscription_lapses_at_its_granted_expiry_2125 fails. nefd's PatchResult arm removed: a_udm_patch_result_reports_the_granted_expiry_2149 fails.
  3. DELETE of a lapsed subscription answers 404, removes it, and releases its leg once. Lapsed check removed: fails at "a DELETE after the expiry finds it gone".
  4. Sweep in parallel per AMF (8 slots), with a failed AMF parked. Semaphore of 1: the_expiry_sweep_releases_per_amf_in_parallel_2149 fails. A failed AMF retried for each leg: same test fails.

Restart: the orphan is now bounded for every subscription that has an expiry. EE subscriptions are not persisted, so after a udmd restart the AMF leg lapses at the granted expiry, at most NEXTGCORE_UDM_EE_MAX_LIFETIME_SECS (1 day) away. nefd always asks for one (#2102).

minor

  1. A consumer that asks for no expiry still gets a leg with no expiry (subscribe_body only adds options when sub.expiry is set). After a udmd restart that leg is orphaned at the AMF with no bound. Options: give the leg the cap as its expiry and let reconcile renew it, or document that only bounded EE subscriptions are restart-safe.
  2. The leg records sub.expiry, not the AMF's answer. amfd echoes the requested expiry, but an AMF that shortens it (TS 29.518 allows that) would lapse the leg while the UDM subscription lives on, and AMF-detected events would stop silently. Reading subscription.options.expiry from the 201 and modify answers, and reconciling on the shorter of the two, closes it.
  3. The PatchResult reason: "granted <DateTime>" is a nextgcore convention. TS 29.571 ReportItem reason is a human-readable account of a modification that was not applied as asked. Against a third-party UDM, nefd's parser takes the last token of any /reportingOptions/expiry ReportItem. If it does not parse, nefd falls back to recording the expiry it asked for, although a ReportItem means that was not applied. Safer: on such an item, keep the previous expiry and let the next sweep retry. Also note the convention in udm.md.

VERDICT: APPROVE

@parlakisik parlakisik added the review-approved Independent reviewer agent approved: corner cases, validation, tests, production readiness label Nov 20, 2026
Spec: specs/udmd-ee-expiry-followups-2149.md

# Conflicts:
#	src/bins/nextgcore-nefd/src/main.rs
@parlakisik
parlakisik merged commit 454079b into main Nov 20, 2026
18 checks passed
@parlakisik
parlakisik deleted the b2-2149-udmd-ee-expiry-followups branch November 20, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-approved Independent reviewer agent approved: corner cases, validation, tests, production readiness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

udmd: EE expiry follow-ups from #2144 review (AMF leg expiry, PATCH grant, DELETE 404, sweep)

1 participant