[MDEV-19499] Prepared statements with 1000 binary parameters and utf8 collation returns no data Created: 2019-05-16  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Prepared Statements, Protocol
Affects Version/s: 10.3.3, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Julius Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None
Environment:

docker image, utf8 collation, prepared statement with > 999 binary parameters.


Attachments: File main.c     File main.go    

 Description   

Since MariaDB 10.3.3 executing prepared statement with more than 999 parameters (binary blobs) return empty data set and no errors if utf8 collation is used and binary blobs contain non ASCII characters (symbols with codes of 128 or higher).

Same query with 999 parameters works fine, having 1000 parameters returns no data.
Same query with ASCII data works fine, having at least one byte >= 128 returns no data.
Same query on connection with collation latin1 works fine, using utf8 returns no data.

Go proof of concept app

We have stumbled on this bug after upgrade to MariaDB 10.3 on our service written in go. Simple go application to reproduce the problem is attached to the issue. Application will spin MariaDB server docker container and execute same query with 999 and 1000 parameters to show the issue. It will try multiple MariaDB versions. Same issue is not present in latest MySQL servers or MariaDB < 10.3.3.

C proof of concept app

Digging deeper into the issue I was able to reproduce it in C code. Demo code attached to the issue (builds with clang main.c -o main `mysql_config --cflags` `mysql_config --libs`).

C app will not spawn any docker containers and expect MariaDB running on localhost:3306.



 Comments   
Comment by Alice Sherepa [ 2019-05-21 ]

Thanks a lot! I repeated as described, with main.c, on current 10.3,10.4 (10.3 592dc59d7a5f9bd80bffdd9d0f0)
Not reproducible on 10.2

Comment by Julius [ 2019-09-06 ]

Are there any news regarding this issue?

We would really appreciate if this issue were resolved. We are currently running our production databases with reduced performance because of this. All our batch queries are forcefully limited to this magic number of 999 parameters.

Comment by Julius [ 2020-06-02 ]

This issue is fixed in 10.3.22 and 10.4.12

mariadb 10.3.21 count 1000 blob [255] -> [] FAILURE
mariadb 10.3.22 count 1000 blob [255] -> [[255]] SUCCESS
 
mariadb 10.4.11 count 1000 blob [255] -> [] FAILURE
mariadb 10.4.12 count 1000 blob [255] -> [[255]] SUCCESS

I guess fix came from MDEV-20900

Comment by Michael [ 2022-02-17 ]

We see a problem with 10.6.7 which fails with prepared statements with more than 999 parameters.
In 10.6.5 it was working fine.

Comment by Alice Sherepa [ 2022-03-11 ]

mipapo there is a regression MDEV-27937, caused by MDEV-23182.

Generated at Thu Feb 08 08:52:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.