[MDEV-15268] Timeout after rnd_next returns HA_ERR_INTERNAL_ERROR (122) Created: 2018-02-10  Updated: 2018-11-01  Resolved: 2018-11-01

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.2.12, 10.1.31
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Olivier Bertrand Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Windows 10


Attachments: File MyClient.exe     File MySql.Data.dll    

 Description   

When called from a C# GUI client, after a logical error, CONNECT returns from rnd_next the 122 error code, MariaDB does not respond until timeout. For example:

create table tloop (
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 tloop;

makes the server not respond until timeout.



 Comments   
Comment by Elena Stepanova [ 2018-03-07 ]

bertrandop, if you already have a test case, can you provide one?

Comment by Olivier Bertrand [ 2018-03-18 ]

Sorry elenst, I should have done it when I created this case. I have edited it to add one.

Comment by Alice Sherepa [ 2018-03-28 ]

I can not reproduce. (Ubuntu 16.04 - MariaDB 10.2.12, 10.2)

MariaDB [test]> create table tloop1 (
    -> n int,
    -> w char(16), /* too small */
    -> f char(3))
    -> engine=connect table_type=csv file_name='/home/alice/Desktop/foo.csv' lrecl=50;
Query OK, 0 rows affected (0.08 sec)
 
MariaDB [test]> select * from tloop1;
ERROR 1296 (HY000): Got error 122 'Field 2 too long for w line 2 of /home/alice/Desktop/foo.csv' from CONNECT
MariaDB [test]> select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
 
MariaDB [test]> select version()æ;
+-----------------+
| æ               |
+-----------------+
| 10.2.12-MariaDB |
+-----------------+
1 row in set (0.00 sec)

Comment by Olivier Bertrand [ 2018-03-29 ]

Actually there is no problem with the standard mysql.exe client. The problem occurs when using a C# GUI that tries to retrieve a query result via a MySqlDataAdapter.

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 (so it is not a loop, I thought so because I had a long timeout setting). The FillError function is not called and the program resumes at the exception catch saying that a timeout exception was raised. On MariaDB side a message says:

6580 [Warning] Aborted connection 6 to db: 'test' user: 'root' host: 'localhost' (Got an error reading communication packets)

And the complete error message is:

System.TimeoutException
  HResult=0x80131505
  Message=Impossible de lire les données de la connexion de transport : Une tentative de connexion a échoué car le parti connecté n’a pas répondu convenablement au-delà d’une certaine durée ou une connexion établie a échoué car l’hôte de connexion n’a pas répondu.
  Source=MySql.Data
  Arborescence des appels de procédure :
   à MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   à MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   à System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
   à MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
   à MySql.Data.MySqlClient.MySqlStream.LoadPacket()
   à MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   à MySql.Data.MySqlClient.NativeDriver.FetchDataRow(Int32 statementId, Int32 columns)
   à MySql.Data.MySqlClient.Driver.FetchDataRow(Int32 statementId, Int32 columns)
   à MySql.Data.MySqlClient.Driver.SkipDataRow()
   à MySql.Data.MySqlClient.ResultSet.Close()
   à MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   à MySql.Data.MySqlClient.MySqlDataReader.Close()
   à MySql.Data.MySqlClient.MySqlDataReader.Dispose()
   à System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   à System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   à System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   à MyClient.View.ExecuteQuery(Boolean b) dans C:\vc2013\Projects\MyClient\MyClient\View.cs :ligne 686
 
Exception interne 1 :
IOException : Impossible de lire les données de la connexion de transport : Une tentative de connexion a échoué car le parti connecté n’a pas répondu convenablement au-delà d’une certaine durée ou une connexion établie a échoué car l’hôte de connexion n’a pas répondu.
 
Exception interne 2 :
SocketException : Une tentative de connexion a échoué car le parti connecté n’a pas répondu convenablement au-delà d’une certaine durée ou une connexion établie a échoué car l’hôte de connexion n’a pas répondu

It is unclear whether the problem is on the GUI or on MariaDB or both. I join the GUI that should work natively on Windows and on Linux via Mono or .NET Core.

Comment by Olivier Bertrand [ 2018-05-10 ]

The problem could be also in the MySQL c# connector. Note that a statement such as

insert into tloop values(45,'abcdefghijklmnopqrstuvwxyz','bar');

correctly returns with an error message.

Comment by Elena Stepanova [ 2018-10-05 ]

According to wlad, there are alternative connectors:

OSS : https://github.com/mysql-net/MySqlConnector
CDATA : www.cdata.com/drivers/mysql/ado
devart : https://www.devart.com/dotconnect/mysql

bertrandop, would you mind to check if the problem is reproducible for you using those?

Comment by Vladislav Vaintroub [ 2018-10-05 ]

IF this is a bug in the connector (which in this case is very likely that a connector does not expect error packet in the middle of result), then it should be reported against the connector, in bugs.mysql.com

If other connectors can handle it, then this is connectors' bug.

Comment by Olivier Bertrand [ 2018-11-01 ]

Indeed, I tried the devart connector and the error does not occur. Therefore, it looks like this is a MySQL connector bug.

Comment by Elena Stepanova [ 2018-11-01 ]

Does anyone want to file a bug report for the connector?

Comment by Olivier Bertrand [ 2018-11-01 ]

I made a bug report, to be consultate at http://bugs.mysql.com/93047.

Comment by Elena Stepanova [ 2018-11-01 ]

Thanks. I'm closing this one, then.

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