Skip to content

Bug Report: streaming query errors surface as 2013 / Lost connection instead of the real error #20382

Description

@timvaillancourt

Overview of the Issue

When a streaming query in vtgate (workload OLAP, multi-statement, or prepared-statement execution) errors after the first row or field packet has been emitted, vtgate closes the TCP connection and the client sees ERROR 2013 (HY000): Lost connection to MySQL server during query instead of the real error code. The opaque 2013 prevents clients from distinguishing a real connection loss from a legitimate query error, and the connection has to be re-established

Common triggers:

  1. KILL QUERY against an in-flight OLAP session (real error is context canceled (errno 1317))
  2. Planner validation errors that surface late (e.g. specifying two different database in the query is not supported)
  3. Per-shard errors discovered after another shard has already streamed rows

Reproduction Steps

Connect to vtgate and switch to OLAP workload:

SET workload = 'OLAP';

-- Should return the planner error, but client sees 2013 instead
SELECT * FROM information_schema.tables
  WHERE table_schema = 'ks1' AND table_schema = 'ks2';

Binary Version

main

Operating System and Environment details

Protocol-level bug, reproducible on any platform

Log Fragments

(none)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions