You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RESP3: FUNCTION LIST/STATS, ARLASTITEMS and FT.* replies inside scripts don't follow the client's protocol #439
These were found while fixing #431 (#436), which fixed Lua script replies. These other replies still send RESP2 shapes, or ignore the script's protocol:
FUNCTION LIST and FUNCTION STATS (src/commands/lua.rs). They send $-1 for a function with no description, and for running_script when nothing is running. Both are also arrays where Redis 7+ sends maps to RESP3 clients.
ARLASTITEMS (src/commands/array.rs, cmd_arlastitems) sends $-1 for empty slots inside a RESP3 array.
FT.SEARCH, FT.AGGREGATE, the hybrid and vector commands, and ARINFO read ctx.resp instead of effective_resp_for_reply. Called from a script, they ignore redis.setresp. Inside MULTI/EXEC on a RESP3 connection, they send RESP3 shapes even under the script's default RESP2.
Compare each one byte for byte with Redis 8 on RESP2 and RESP3 clients, and from scripts with setresp(2) and setresp(3).
One more, left deliberately by #436: a Lua reply table with botherr and ok (return {err='e1', ok='o1'}) is sent as the status +o1, where Redis checks err first and sends -e1. Checking err first costs every status reply an extra table lookup, measured at +1.4–3.8% on a SET-lock script. If it's fixed, it should be done without that cost, for example by reading reply tables through raw FFI.
Activity
murtazayusuf commentedon Nov 5, 2026
More pre-existing differences in Lua reply conversion, found while reviewing #436. Each was checked against Redis source semantics, not run:
{big_number=…}replaces only the\r\npair and then trims. Redis maps each\rand\nto a space and doesn't trim.setis checked beforemap; Redis checksmapfirst. This only matters for a table that has both.verbatim_stringwhoseformatorstringisn't a string is an error here. Redis falls through to the map, set and array checks.{err='x\r\n'}keeps trailing spaces; Redis trims trailing CR/LF first.okanderruseto_string_lossy, so non-UTF-8 bytes become U+FFFD where Redis sends the raw bytes.murtazayusuf commentedon Nov 5, 2026
One more, left deliberately by #436: a Lua reply table with both
errandok(return {err='e1', ok='o1'}) is sent as the status+o1, where Redis checkserrfirst and sends-e1. Checkingerrfirst costs every status reply an extra table lookup, measured at +1.4–3.8% on a SET-lock script. If it's fixed, it should be done without that cost, for example by reading reply tables through raw FFI.