Skip to content

Remove AmfRan from pool on SCTP connection close#748

Merged
gab-arrobo merged 3 commits into
omec-project:mainfrom
gab-arrobo:remove-AmfRan
Jul 11, 2026
Merged

Remove AmfRan from pool on SCTP connection close#748
gab-arrobo merged 3 commits into
omec-project:mainfrom
gab-arrobo:remove-AmfRan

Conversation

@gab-arrobo

@gab-arrobo gab-arrobo commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

When a RAN connection goroutine exited, the corresponding AmfRan entry was never removed from AMFContext.AmfRanPool. The Dispatch function already handles an empty message as a connection-close signal by calling ran.Remove(), but this signal was never sent on the direct SCTP path.

The fix sends an empty byte slice via handler.HandleMessage in the defer block of handleConnection, reusing the existing empty-message cleanup path. This ensures that on connection close, ran.Remove() is called, which removes all associated RanUe entries, deletes the AmfRan from 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

Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 trigger ngap.Dispatch’s len(msg) == 0 close-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.

Copilot AI review requested due to automatic review settings July 11, 2026 04:47
cmaciocco
cmaciocco previously approved these changes Jul 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread ngap/service/service.go Outdated
Comment thread ngap/service/service.go Outdated
Copilot AI review requested due to automatic review settings July 11, 2026 05:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread ngap/service/service.go
Comment thread ngap/dispatcher.go Outdated
Comment thread ngap/dispatcher.go
Copilot AI review requested due to automatic review settings July 11, 2026 05:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread ngap/dispatcher_test.go Outdated
Copilot AI review requested due to automatic review settings July 11, 2026 05:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread ngap/service/service.go Outdated
Copilot AI review requested due to automatic review settings July 11, 2026 05:30
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread ngap/service/service.go
@gab-arrobo
gab-arrobo requested a review from cmaciocco July 11, 2026 05:39
@gab-arrobo
gab-arrobo requested a review from a team July 11, 2026 05:41
@gab-arrobo
gab-arrobo merged commit 7cb659a into omec-project:main Jul 11, 2026
12 checks passed
@gab-arrobo
gab-arrobo deleted the remove-AmfRan branch July 11, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants