[SMF] track and fix scenario where gtp node mempool becomes full (#1622)
* [SMF] Avoid abort() if gtp_node mempool becomes full Related: https://github.com/open5gs/open5gs/issues/1621 * [SMF] metrics: Add new ctr tracking gtp_node allocation failures This metrics is useful to track whether at some point the mempool went full, so that config needs to be updated to increase the mempool size.
This commit is contained in:
parent
b58ebda556
commit
3501cb0a5b
|
@ -55,6 +55,7 @@ static void _gtpv1v2_c_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
ogs_sockaddr_t from;
|
||||
ogs_gtp_node_t *gnode = NULL;
|
||||
uint8_t gtp_ver;
|
||||
char frombuf[OGS_ADDRSTRLEN];
|
||||
|
||||
ogs_assert(fd != INVALID_SOCKET);
|
||||
|
||||
|
@ -89,7 +90,12 @@ static void _gtpv1v2_c_recv_cb(short when, ogs_socket_t fd, void *data)
|
|||
gnode = ogs_gtp_node_find_by_addr(&smf_self()->sgw_s5c_list, &from);
|
||||
if (!gnode) {
|
||||
gnode = ogs_gtp_node_add_by_addr(&smf_self()->sgw_s5c_list, &from);
|
||||
ogs_assert(gnode);
|
||||
if (!gnode) {
|
||||
ogs_error("Failed to create new gnode(%s:%u), mempool full, ignoring msg!",
|
||||
OGS_ADDR(&from, frombuf), OGS_PORT(&from));
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
return;
|
||||
}
|
||||
gnode->sock = data;
|
||||
smf_gtp_node_new(gnode);
|
||||
smf_metrics_inst_global_inc(SMF_METR_GLOB_GAUGE_GTP_PEERS_ACTIVE);
|
||||
|
|
|
@ -49,6 +49,11 @@ ogs_metrics_spec_t *smf_metrics_spec_global[_SMF_METR_GLOB_MAX];
|
|||
ogs_metrics_inst_t *smf_metrics_inst_global[_SMF_METR_GLOB_MAX];
|
||||
smf_metrics_spec_def_t smf_metrics_spec_def_global[_SMF_METR_GLOB_MAX] = {
|
||||
/* Global Counters: */
|
||||
[SMF_METR_GLOB_CTR_GTP_NEW_NODE_FAILED] = {
|
||||
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
|
||||
.name = "gtp_new_node_failed",
|
||||
.description = "Unable to allocate new GTP (peer) Node",
|
||||
},
|
||||
[SMF_METR_GLOB_CTR_GN_RX_PARSE_FAILED] = {
|
||||
.type = OGS_METRICS_METRIC_TYPE_COUNTER,
|
||||
.name = "gn_rx_parse_failed",
|
||||
|
|
|
@ -9,7 +9,8 @@ extern "C" {
|
|||
|
||||
/* GLOBAL */
|
||||
typedef enum smf_metric_type_global_s {
|
||||
SMF_METR_GLOB_CTR_GN_RX_PARSE_FAILED = 0,
|
||||
SMF_METR_GLOB_CTR_GTP_NEW_NODE_FAILED = 0,
|
||||
SMF_METR_GLOB_CTR_GN_RX_PARSE_FAILED,
|
||||
SMF_METR_GLOB_CTR_GN_RX_CREATEPDPCTXREQ,
|
||||
SMF_METR_GLOB_CTR_GN_RX_DELETEPDPCTXREQ,
|
||||
SMF_METR_GLOB_CTR_S5C_RX_PARSE_FAILED,
|
||||
|
|
Loading…
Reference in New Issue