Remove AmfRan from pool on SCTP connection close#748
Merged
Conversation
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
There was a problem hiding this comment.
Pull request overview
This PR ensures AmfRan entries are removed from AMFContext.AmfRanPool when a direct SCTP RAN connection closes by reusing the existing empty-message cleanup path in ngap.Dispatch.
Changes:
- On SCTP connection goroutine exit, sends an empty message via
handler.HandleMessage(conn, []byte{})to triggerngap.Dispatch’slen(msg) == 0close-handling. - Keeps the cleanup sequence in a single place (
ran.Remove()), preventing stale RAN/UE context and leaked pool entries on gNB churn.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cmaciocco
previously approved these changes
Jul 11, 2026
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
VERSION:2
- The VERSION file currently has an extra blank line. Make reads this file via
$(shell cat ./VERSION ...), so multiple lines are converted to a space-separated string (e.g. "3.1.2 "), which can lead to invalid/whitespace-tainted tags or labels.
3.1.2
gab-arrobo
force-pushed
the
remove-AmfRan
branch
from
July 11, 2026 05:30
d422f42 to
cc6e4c9
Compare
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
cmaciocco
approved these changes
Jul 11, 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.
When a RAN connection goroutine exited, the corresponding
AmfRanentry was never removed fromAMFContext.AmfRanPool. TheDispatchfunction already handles an empty message as a connection-close signal by callingran.Remove(), but this signal was never sent on the direct SCTP path.The fix sends an empty byte slice via
handler.HandleMessagein the defer block ofhandleConnection, reusing the existing empty-message cleanup path. This ensures that on connection close,ran.Remove()is called, which removes all associatedRanUeentries, deletes theAmfRanfrom the pool, and publishes a gNB-disconnected metric event, which prevents stale entries, misdirected paging, and a resource leak proportional to gNB churn.Also, create a patch release