When using a Datascript for RADIUS persistence in Avi Load Balancer, the script may fail to execute. When this occurs, the request fails with the following virtual service log:
Request ended abnormally: Datascript failed to execute
The following stack trace can be observed under the "Datascript log" section of the virtual service log:
Datascript Log: vip_port=1812[string "xyz"]:14: bad argument #1 to 'len' (string expected, got nil)
This error occurs because the deployed RADIUS Datascript relies on specific attributes, namely calling_station_id and nas_ip, to perform persistence.
If these specific attributes (calling_station_id and/or nas_ip) are missing from the incoming RADIUS packets, the variables evaluate to nil.
When the script attempts to calculate the length (len) of these missing attributes, it triggers the bad argument #1 to 'len' (string expected, got nil) error and aborts execution.
Documentation Reference: Load Balancing RADIUS with Cisco ISE
Script Source: GitHub - Radius-DHCP-HTTPS.lua
To resolve this issue, please use the updated DataScript which handles the scenarios where the required RADIUS attributes are missing from the payload.
Implementation Steps: