8000 RESP3: FUNCTION LIST/STATS, ARLASTITEMS and FT.* replies inside scripts don't follow the client's protocol · Issue #439 · kividbio/kividb · GitHub
[go: up one dir, main page]

Skip to content

RESP3: FUNCTION LIST/STATS, ARLASTITEMS and FT.* replies inside scripts don't follow the client's protocol #439

Open

Description

@murtazayusuf

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:

  1. 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.
  2. ARLASTITEMS (src/commands/array.rs, cmd_arlastitems) sends $-1 for empty slots inside a RESP3 array.
  3. 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).

Activity

  1. added
    bugSomething isn't working
    redis-compatA test in Redis's own test suite fails against KiviDB
    on Nov 5, 2026
  2. murtazayusuf commented on Nov 5, 2026

    @murtazayusuf
    ContributorAuthor

    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\n pair and then trims. Redis maps each \r and \n to a space and doesn't trim.
    • set is checked before map; Redis checks map first. This only matters for a table that has both.
    • A verbatim_string whose format or string isn't a string is an error here. Redis falls through to the map, set and array checks.
    • The nesting cap of 64 turns the whole reply into an error. Redis's limit is much deeper and fails only the nested element.
    • {err='x\r\n'} keeps trailing spaces; Redis trims trailing CR/LF first.
    • ok and err use to_string_lossy, so non-UTF-8 bytes become U+FFFD where Redis sends the raw bytes.
  3. murtazayusuf commented on Nov 5, 2026

    @murtazayusuf
    ContributorAuthor

    One more, left deliberately by #436: a Lua reply table with both err 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingredis-compatA test in Redis's own test suite fails against KiviDB

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0