For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

You are reading Session Management Controller 3.14, an older release. The newest release is 3.17. Go to 3.17

Session handling

When updating the Packet Gateway (PGW) or other critical components, it’s important to minimize active sessions on the PGW to reduce service impact. This document explains how to manage sessions during such operations by:

  • Rejecting new session requests to prevent additional load.
  • Draining existing sessions, allowing them to end naturally without accepting new ones.
  • Actively terminating sessions to immediately free up resources or speed up maintenance.

You can perform these actions through the system’s API. To access the API, start by setting up a port-forward to the target pod, for example:

bash

Reject new sessions

You can check and update the internal state of the service to control whether it accepts or reject new sessions through the API. Run this command to reject new sessions and lower the impact on PGW:

bash

As you can see in the output, new sessions are accepted:

json

Run this command to change the state and reject new sessions:

bash

Now, the output shows that new sessions are rejected:

json

Drain sessions

Caution

Draining sessions increases the memory usage that mainly depends on the current number of sessions and not on the number of sessions to delete (around 2.6GB for 250k current sessions). Remove a large number of sessions (for example, 2000) at once instead of repeatedly removing a small number of sessions.

Run this command to drain the existing sessions:

bash

As you can see in the output example, there are 865 active contexts (sessions) remaining in the system after processing the DELETE request:

json

You can also drain the existing sessions in a loop, which means continuously checking for active sessions and terminating them one by one (or in batches) until none are left. To do so, run:

bash

This command sends a DELETE request every 5 seconds. As we can see in the output example, after first run there are 765 sessions, after second run there are 665 sessions, and after third run - 565 sessions:

json

Using the ergw Erlang API without a specific type refers to contexts of all types. The following commands delete both GTP-initiated and TDF (PFCP-initiated) contexts:

erlang

Get TDF sessions

FEATURE STATE: alpha

Obtain contexts per type from an Erlang shell:

erlang

Using the ergw Erlang API without a specific type refers to contexts of all types. The following commands delete both GTP-initiated and TDF (PFCP-initiated) contexts:

erlang

Drain TDF Sessions

FEATURE STATE: alpha

Drain sessions per type from an Erlang shell:

erlang

Caution

The following script can be used at an Erlang shell to manually remove TDF contexts in previous releases. Incorrect usage may result in session termination without AAA termination and may cause a node reboot.

Split is provided due to the limitations of lists:split/2.

erlang

List and close PFCP associations

All existing PFCP associations can be found through the Sx node registry using this command:

erlang

See the output example:

erlang

A single PFCP association can be removed through ergw_sx_node:down(Key), where Key is either the PID of the Sx process or any other key the association is registered with. In the example above, the key can be either the linked PID (for example <0.3179.0>), the IP of the PFCP peer in tuple form (for example {127,0,200,1}) or the FQDN of the PFCP peer in binary format (for example <<"topon.sx.prox01.epc.mnc001.mcc001.3gppnetwork.org">>).

erlang

Note

Invoking down will behave as if a node down (no PFCP Echo response) were detected. All sessions that existed in that UPF will receive a down notification and be closed. The retry counter for PFCP Association Requests will also be reset to 0, triggering an immediate reconnection attempt.