Skip to content

Incorrectly attempt to use a collation with id larger than 255 during backend handshake #4841

@renecannao

Description

@renecannao
  • A clear description of the issue

When creating a backend connection, if the frontend connection has configured a collation with id larger than 255 (for example using SET NAMES utf8mb4 COLLATE utf8mb4_0900_as_ci; , ProxySQL may try to create a new connection using such collation.
The problem is that at protocol level, during handshake only 1 byte can be used to configure the collation.
That means that if ProxySQL sets a collation greater than 255 , only the less significant byte is used.
Therefore even if ProxySQL believes that the backend connection will use the specified collation, mysql_real_connect() is using a different collation. For example, using collation 305 will lead to use collation 49 (305-256).

  • ProxySQL version

All to to-date

  • OS version

All

  • The steps to reproduce the issue

Start proxysql with basic configuration, and without any traffic.
Create a new connection, and issue the following commands:

SET NAMES utf8mb4 COLLATE utf8mb4_0900_as_ci;
SHOW VARIABLES LIKE 'character_set%';

The character set reported will be incorrect (latin1) .

  • The full ProxySQL error log (default location: /var/lib/proxysql/proxysql.log)

Nothing relevant

Progress

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions