Bug #102467 MySQL ODBC Connector *8.0.23* 'Malformed communication packet' with ADO.NET Data
Submitted: 3 Feb 2021 9:55 Modified: 8 Jun 2021 22:18
Reporter: Josip Pantovic Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version: OS:Any
Assigned to: CPU Architecture:Any

[3 Feb 2021 9:55] Josip Pantovic
Description:
Case: ADO.NET DataAdapter, inserting a new row containing long text to be inserted into a %TEXT column, without specifying values for columns after it - fails with MySQL ODBC Connector 8.0.23 connecting to 8.0.23 server.

How to repeat:
Sample code below fails with MySQL ODBC Connector 8.0.23 connecting to 8.0.23 server, due to:
ERROR [HY000] [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.23]Malformed communication packet.

It works as expected when:
- using MySQL ODBC Connector 8.0.22 with 8.0.23 server
- using MySQL ODBC Connector 8.0.23 with an earlier server version
- text length is <= 8183.

public void TestOdbc8023_DataSet()
{
string longText = "";
for (int i = 0; i < 8184; i++)
longText += "a";

using (var conn = new System.Data.Odbc.OdbcConnection("DSN=VM"))
{
conn.Open();

// Create table
var createTableSql =
@"CREATE TABLE IF NOT EXISTS test_malformed (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name MEDIUMTEXT NOT NULL,
deleted TINYINT DEFAULT NULL
) Engine=InnoDB;";

using (var cmd = new System.Data.Odbc.OdbcCommand(createTableSql, conn))
{
cmd.ExecuteNonQuery();
}

// Setup adapter + DatSet
using (var adapter = new System.Data.Odbc.OdbcDataAdapter("SELECT * FROM test_malformed WHERE 1 = 0", conn))
using (var builder = new System.Data.Odbc.OdbcCommandBuilder(adapter))
{
var dataTable = new System.Data.DataTable("test_malformed");
adapter.Fill(dataTable);

// insert
var row = dataTable.NewRow();
row["name"] = longText;
dataTable.Rows.Add(row);

adapter.Update(dataTable);
}
}
}
[25 Feb 2021 7:37] MySQL Verification Team
Hello Josip Pantovic,

Thank you for the bug report.
Discussed this issue internally with the Connector/ODBC developer and confirmed the issue as described. Thank you!

Regards,
Ashwini Patil
[26 Feb 2021 9:21] Bogdan Degtyariov
Posted by developer:
 
The problem is in libmysqlclient.
Check the base bug number for more details.
[26 Feb 2021 9:26] Bogdan Degtyariov
Reported a bug in libmysqlclient:
https://bugs.mysql.com/bug.php?id=102744
[24 May 2021 14:24] Bogdan Degtyariov
Posted by developer:
 
The issue was fixed in libmysqlclient, added a new test case.
[24 May 2021 14:25] Bogdan Degtyariov
Posted by developer:
 
No code change was required in Connector/ODBC. In order to apply the fix it needs to be linked against libmysqlclient 8.0.26
[8 Jun 2021 22:18] Philip Olson
Posted by developer:
 
This was a MySQL Server bug, one fixed in libmysqlclient 8.0.26.