ytsaurus-ui icon indicating copy to clipboard operation
ytsaurus-ui copied to clipboard

Queries interface fails if response has non-utf8 symbols

Open Krock21 opened this issue 11 months ago • 3 comments

Queries interface fails if response has non-utf8 symbols

How to reproduce:

  1. Submit "привет" CHYT query.
  2. See how interface fails with an error Error occurred while parsing YSON[1], Invalid UTF-8 string in JSON[1]

Or use CLI to reproduce:

yt start-query chyt "привет"
queryID
yt get-query queryID --format '<encode_utf8=%false>json'
HTTP 400 Error occurred while parsing YSON Invalid UTF-8 string in JSON

This is because CHYT converts clickhouse-thrown std::exception into YT TError directly, in binary format (using exception.what())

Then it is stored in dynamic table in binary format:

"inner_errors" = [
        {
            "attributes" = {
                "datetime" = "2024-03-08T17:27:47.033681Z";
                "fid" = 0u;
                "host" = "our-host.net";
                "pid" = 3673;
                "thread" = "ThreadPool";
                "tid" = 7905737751553949491u
            };
            "code" = 1;
            "message" = 53 79 6e 74 61 78 20 65 72 72 6f 72 3a 20 66 61 69 6c 65 64 20 61 74 20 70 6f 73 69 74 69 6f 6e 20 31 20 28 27 d0 27 29 3a 20 d0 be d1 88 d0 b8 d0 b1 d0 ba d0 b0 31 2e 20 55 6e 72 65 63 6f 67 6e 69 7a 65 64 20 74 6f 6b 65 6e 3a 20 27 d0 27
        }

and can't be decoded into UTF8 json on server side, resulting in failure

Krock21 avatar Mar 06 '24 15:03 Krock21