This is an old bug, observed at least since 2.2 - see
MXS-1760. Encountered it again in clearer situation.
0. The client (Matomo web analytics software) is written in PHP using their standard classes and runs in PHP-7.2 Connections are made ad-hoc (no pool is used of any kind). The particular job is run via cron and executes several statements in a single session (no parallel connections are used).
1. The client extracts some data from a MariaDB database and writes a local delimited file.
2. The client (unaware that it is remote) tries LOAD DATA INFILE and fails with "permission denied".
3. The client retries, this time with LOAD DATA LOCAL INFILE.
4. The client receives MySQL TABULAR packet with the name of the file to upload.
5. The client uploads the file.
6. Instead of passing the file to the MariaDB backed, MaxScale tries to somehow parse it and then to execute a prepared statement with a non-existent ID.
7. The backend having no such prepared statement ID returns an error and MaxScale closes the connection to the client.
MaxScale is configured with read-write split.
This is a shared system with many third-party applications, so "use_sql_variables_in=master" was needed at some point.
The actual LOAD statement is:
MaxScale error log file entries:
Unfortunately, I cannot get a copy of the actual file as Matomo deletes it immediately after the error, but the tcpdump and the table name both suggest there are some BLOB values there. The dump is available if interesting to you.
The same client job runs against the primary node without a problem.
How can we make MaxScale just pass the uploaded file to the primary node and not try to parse it, deriving a non-existent prepared statement ID?