Bug #93047 Timeout after a read error returns HA_ERR_INTERNAL_ERROR (122)

Submitted: 1 Nov 2018 17:30 Modified: 4 Nov 2018 11:33
Reporter: Olivier Bertrand Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.0.13 OS:Windows (10)
Assigned to: CPU Architecture:Any

[1 Nov 2018 17:30] Olivier Bertrand
Description:
When called from a C# GUI client, after a read next logical error returning the 122 error code, the GUI is frozen until a timeout occurs.

The problem occurs when using a C# GUI that tries to retrieve a query result via a MySqlDataAdapter.

The code:

dqry = qry;
ln.Clear();
data = new DataTable();
da = new MySqlDataAdapter(qry, conn);
da.FillError += new FillErrorEventHandler(FillError);
 
try {
    da.Fill(data);
} catch (ArgumentNullException) {
    return;
} catch (Exception) {
    throw;
} // end try/catch
 
da.FillError -= new FillErrorEventHandler(FillError);

What happens, in case of read error, is that the Fill function does not return until a timeout occurs. The FillError function is not called and the program resumes at the exception catch saying that a timeout exception was raised.

How to repeat:
For instance, connected to MariaDB, using the CONNECT storage engine:

create table tmout (
n int,
w char(16), /* too small */
f char(3))
engine=connect table_type=csv file_name='foo.csv' lrecl=50;

The file foo.csv being:

26,Hello world!,foo
45,abcdefghijklmnopqrstuvwxyz,bar

Executing:

select * from tmout;

makes the connector not to respond until timeout.

Note that a statement such as

insert into tmout values(45,'abcdefghijklmnopqrstuvwxyz','bar');
correctly returns with an error message.

Suggested fix:
It is very likely that the connector does not expect error packet in the middle of result.
[1 Nov 2018 18:19] MySQL Verification Team
Thank you for the bug report. Server MariaDB isn't supported by MySQL connectors.
[3 Nov 2018 10:29] Olivier Bertrand
Please don't sweep it so quickly under the rug. 

I didn't know how to generate a read error using the MySQL server but finally I found this way:

create table tmout (
n int not null,
w char(16) not null, /* will be too small */
f char(3) not null)
engine=CSV;
insert into tmout values
(26,'Hello world!','foo'),
(45,'abcdefghijklmnop','bar');

Then stop the MySQL server and using an editor increase the second line of tmout.CSV to become:

45,"abcdefghijklmnopqrstuvwxyz"

Restart the MySQL server. Using the standard mysql client, when doing:

select * from tmout;

It replies:

ERROR 1194 (HY000): Table 'tmout' is marked as crashed and should be repaired

Now, using the C# GUI, doing the same thing reproduce the bug: no answer until a timeout occurs.
[3 Nov 2018 23:19] Olivier Bertrand
What do you mean by "works as expected"? That a connector can hide an error, wait for an eventually long time before returning in case of error and do not display the normal error message but just say that a timeout occured?
[3 Nov 2018 23:21] Olivier Bertrand
I tried with another connector and this bug does not occur.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.059 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.