[UPF] Handle session allocation failure gracefully when maximum sessions are reached (#3964)

In upf_sess_add, replace the unconditional assertion on sess with a check
that detects when the session pool is exhausted. If allocation fails,
log an error message (“Maximum number of Session reached”) and
return NULL instead of aborting the process.

This change prevents the UPF from crashing when the PFCP session limit (4096) is
exceeded and allows it to reject additional session establishment requests
cleanly.
This commit is contained in:
Sukchan Lee
2025-07-01 16:52:34 +09:00
parent 67ba7f92bb
commit c86f9150ec

View File

@@ -178,7 +178,10 @@ upf_sess_t *upf_sess_add(ogs_pfcp_f_seid_t *cp_f_seid)
ogs_assert(cp_f_seid);
ogs_pool_id_calloc(&upf_sess_pool, &sess);
ogs_assert(sess);
if (!sess) {
ogs_error("Maximum number of Session reached");
return NULL;
}
ogs_pfcp_pool_init(&sess->pfcp);