Bug #94190 MySQL .Net Connector -Authentication error - Reading from the stream has failed
Submitted: 4 Feb 2019 13:43 Modified: 8 Feb 2019 9:58
Reporter: Hardik Shah Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:5.6.19-log OS:Windows
Assigned to: CPU Architecture:Any
Tags: AuthenticationError, ReadingFromNet, ReadingFromStreamFailed

[4 Feb 2019 13:43] Hardik Shah
Description:
Hello Team,

We have recently found too many Authentication Errors in our application. It is not continuous, however it appears multiple times in a day and gets stuck. We are having ASP.Net Application hosted on IIS in Windows Server 2012 R2 Standard. We also have separate server with same configuration where MySQL has been installed.

Some times our query gets stuck in below stage.

unauthenticated user  - <IP> - <DB> - Connect - NULL - Reading from net - NULL
unauthenticated user  - <IP> - <DB> - Connect - NULL - Reading from net - NULL
unauthenticated user  - <IP> - <DB> - Connect - NULL - Reading from net - NULL
unauthenticated user  - <IP> - <DB> - Connect - NULL - Reading from net - NULL
unauthenticated user  - <IP> - <DB> - Connect - NULL - Reading from net - NULL
unauthenticated user  - <IP> - <DB> - Connect - NULL - Reading from net - NULL

There are multiple connections like this, and after some times, it gives us below error.

Authentication to host <IP> for user <USER> using method 'mysql_native_password' failed with message: Reading from the stream has failed.

This error has started increasing too much from nowadays and it is getting effected with our client's work.

Just to update you we are using MySQL Connector DLL Version 6.8.3.0.

Please help us with the solution here.

Thnaks
Hardik

How to repeat:
As this error can appear at any point of time, there is no such process through which we can repeat the error.

Our C# .Net application connect the MySQL using connection string like below.

"server=<IP>; user id=<USER>; password=<PASSWORD>; database=<DB>; pooling=false; port=<PORT>;"

We just use the same code to connect to MySQL.

var con = new MySQLConnection(<CONNSTRING>);
con.Open();
//DO CALL STORED PROCEDURE TO USE SELECT 
con.Close();

This is how we get the data.

Suggested fix:
Someone had suggested solution here.

http://www.voidcn.com/article/p-phfoefri-bpr.html

We tried first and last option, but did not work out hence got rolled it back.
[5 Feb 2019 10:35] MySQL Verification Team
Hello Hardik Shah,

Thank you for the bug report.
This is most likely duplicate of Bug #76597, please see Bug #76597

Thanks,
Umesh
[5 Feb 2019 11:00] Hardik Shah
Hello Team,

We had tried some of the solutions provided there by adding net_read_timeout and by providing SSL changes. But it did not resolve the issue.

Now, we are going to try the Connection.Ping method before making an Connection.Open call. Let us see if this resolve that issue.

Let me know any other suggestion we can try out like upgrading the MySQL DLL Connector.

Thanks
Hardik
[6 Feb 2019 7:48] Hardik Shah
Hello Team,

We had tried some of the solutions provided there by adding net_read_timeout and by providing SSL changes. But it did not resolve the issue.

Now, we are going to try the Connection.Ping method before making an Connection.Open call. Let us see if this resolve that issue.

Let me know any other suggestion we can try out like upgrading the MySQL DLL Connector.

Thanks
Hardik
[8 Feb 2019 9:58] Hardik Shah
Please open this ticket as we are not able to find solution to this error.

We have tried all options suggested, but still facing the same error.

Thanks
Hardik