Skip to content

fix(exp_006): handle systemd port conflict — add Preexisting AMF runtime variant - #26

Merged
j143 merged 2 commits into
mainfrom
copilot/test-open5gc-6g-integration
Feb 28, 2026
Merged

j143 merged 2 commits into
mainfrom
copilot/test-open5gc-6g-integration

Conversation

Copilot AI commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

When open5gs-amf installs via apt, systemd auto-starts open5gs-amfd, pre-binding SBI port 7777 and Prometheus port 9090. The experiment then spawned a second instance that exited immediately, leaving AmfRuntime::NativePid holding a dead Child while silently falling through to the systemd-managed instance — no diagnostic, no clean ownership.

Changes

experiments/exp_006_open5g_core_comparison/run.rs

  • New AmfRuntime::Preexisting variant — models "instance already running, we don't own it"; Drop is a no-op
  • Immediate-exit detection — after spawn, polls child.try_wait() every 100 ms for up to 1 s; if the process exits, logs the exit status and falls back to Preexisting rather than holding a zombie Child
  • Metrics address detection (detect_metrics_addr) extracted before the match — eliminates the duplicated call across branches
let immediate_exit = (0..10).find_map(|_| {
    std::thread::sleep(Duration::from_millis(100));
    child.try_wait().ok().and_then(|s| s)
});
let runtime = match immediate_exit {
    Some(status) => {
        println!("Binary exited immediately (status={status}); using pre-existing open5gs AMF instance");
        AmfRuntime::Preexisting
    }
    None => AmfRuntime::NativePid(child),
};

.github/workflows/open5gs-integration.yml

  • New step: "Stop systemd open5gs-amfd service" — runs systemctl stop/disable open5gs-amfd + 1 s port-release pause before the experiment, so CI always exercises the NativePid path with a fresh controlled instance
  • Preexisting remains as a graceful fallback for local dev where systemd cannot be stopped
Original prompt

This section details on the original issue you should resolve

<issue_title>test with actual open5gc vs our 6g system</issue_title>
<issue_description>```
=== exp_006: open5GS Actual System Integration Test ===
[Step 0] Native open5gs binary detected: /usr/bin/open5gs-amfd
Config: /etc/open5gs/amf.yaml
Open5GS daemon v2.7.6
02/28 15:55:59.304: [app] INFO: Configuration: '/etc/open5gs/amf.yaml' (../lib/app/ogs-init.c:144)
02/28 15:55:59.304: [app] INFO: File Logging: '/var/log/open5gs/amf.log' (../lib/app/ogs-init.c:147)
02/28 15:55:59.307: [sbi] INFO: Setup NF EndPoint(addr) [127.0.0.200:7777] (../lib/sbi/context.c:507)
Failed to bind to port 0: Address already in use
02/28 15:55:59.307: [metrics] ERROR: Cannot start Prometheus HTTP server (../lib/metrics/prometheus/context.c:283)
02/28 15:55:59.307: [sbi] INFO: NF Service [namf-comm] (../lib/sbi/context.c:1994)
02/28 15:55:59.307: [sock] ERROR: socket bind(2) [127.0.0.5]:7777 failed (98:Address already in use) (../lib/core/ogs-socket.c:114)
02/28 15:55:59.307: [sock] ERROR: tcp_server() [127.0.0.5]:7777 failed (98:Address already in use) (../lib/core/ogs-tcp.c:72)
02/28 15:55:59.307: [sbi] ERROR: Cannot start SBI server (../lib/sbi/nghttp2-server.c:414)
02/28 15:55:59.307: [sctp] ERROR: Failed to initialize AMF (../src/amf/app.c:30)
02/28 15:55:59.307: [app] FATAL: Open5GS initialization failed. Aborted (../src/main.c:224)
Metrics endpoint: 127.0.0.5:9090
[Step 1] Actual open5gs AMF configuration (open5gs (native))
PLMN: 999/70
TAC: 1
SST: 1
SBI port: 7777
[Step 2] Live open5gs AMF metrics (no UEs attached yet)
fivegs_amffunction_rm_reginitreq : 0
fivegs_amffunction_rm_reginitsucc: 0
fivegs_amffunction_amf_authreq : 0 ← per-UE auth cost (TS 33.501 §6.1)
amf_session: 0 gnb: 0
[Step 3] 6G SBAv2 simulation — PLMN 999/70 TAC 1 SST 1 (5 UEs)
UE=999700000000001 session_id=1 ip=10.0.0.1 qci=9 gbr=0kbps
UE=999700000000002 session_id=2 ip=10.0.0.2 qci=9 gbr=0kbps
UE=999700000000003 session_id=3 ip=10.0.0.3 qci=9 gbr=0kbps
UE=999700000000004 session_id=4 ip=10.0.0.4 qci=9 gbr=0kbps
UE=999700000000005 session_id=5 ip=10.0.0.5 qci=9 gbr=0kbps
[Step 4] NAS overhead comparison
open5gs live (after sim): reginitreq=0 authreq=0
Projected 5G NAS cost for 5 UEs (open5gs schema):
reginitreq = 5 (one per UE)
authreq = 5 (one per UE — TS 33.501 §6.1)
6G SBAv2 actual result for 5 UEs:
validated = 5 (SBAv2 inline token — 1 RTT)
authreq = 0 (eliminated — token inline in first PDU)
authreq_reduction = 100%
[Step 5] [baseline: open5gs (actual binary) / registration_success_rate] citation: https://github.com/open5gs/open5gs
All 1 comparison points within tolerance ✓
open5gs live: PLMN 999/70 TAC 1 SST 1 (open5gs (native))
6G SBAv2: 5 UEs, 5 sessions, 67 B UPF uplink
NAS overhead: 5G NAS = 1/UE auth RTT → 6G SBAv2 = 0 (100% reduction)
All exp_006 checks PASSED ✓


<agent_instructions>this experiment is facing the issue. the actual open5gs doesn't seem to work. and actual 6g implementation actual call flow comparison.</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ntime + stop service in CI

Co-authored-by: j143 <53068787+j143@users.noreply.github.com>
Copilot AI changed the title [WIP] Test with actual Open5GC versus our 6G system fix(exp_006): handle systemd port conflict — add Preexisting AMF runtime variant Feb 28, 2026
@j143
j143 marked this pull request as ready for review February 28, 2026 16:41
@j143
j143 merged commit 7413be8 into main Feb 28, 2026
9 checks passed
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.

test with actual open5gc vs our 6g system

2 participants