Bug #113501 Application Crash When Connecting to MySQL Sever
Submitted: 22 Dec 2023 20:20 Modified: 16 Jun 12:38
Reporter: ahmed taha Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.2 OS:Windows
Assigned to: MySQL Verification Team CPU Architecture:Any

[22 Dec 2023 20:20] ahmed taha
Description:
I am experiencing an issue where my application crashes without any exception messages when attempting to connect to the MySQL server. This issue started occurring after upgrading to MySqlConnector version 8.2. The problem is intermittent, and I am unable to capture any specific error information even with try-catch blocks.

How to repeat:
it only happens while using slow internet connection

Try
    
  con.Open()

Catch ex As MySqlException

    msgbox(ex.Message)  

Catch ex As Exception

    msgbox(ex.Message)  

end try

Suggested fix:
Throw an Exception
[22 Dec 2023 20:52] ahmed taha
I managed to test it again after limiting my internet connection speed

Attachment: Screenshot 2023-12-22 225054.png (image/png, text), 285.12 KiB.

[22 Dec 2023 20:53] ahmed taha
i added 

Catch ex As AggregateException

still not catch anything
[22 Dec 2023 20:55] ahmed taha
the screenshot i sent is from .Net connector source code debug
[22 Dec 2023 22:16] ahmed taha
i tested again 
This only happens when i use ssl
if i connect without ssl a normal exception thrown
[23 Dec 2023 13:44] ahmed taha
the unhandled exception originally thrown from this function 

 public async Task<Tuple<MySqlStream, Stream>> StartSSLAsync(Stream baseStream, Encoding encoding, string connectionString, CancellationToken cancellationToken, bool execAsync)

at this block of code

 using (cancellationToken.Register(() => throw new AggregateException($"Authentication to host '{_settings.Server}' failed.", new IOException())))
   sslStream.AuthenticateAsClientAsync(_settings.Server, certs, tlsProtocol, false).GetAwaiter().GetResult();

the exception is not handled by the library and cause application to crush
[23 Dec 2023 13:47] ahmed taha
I used "Net limiter" to limit my application internet speed to 1KB In and Out
[10 Jan 2024 2:05] ahmed taha
Follow-Up
[31 Jan 2024 11:48] MySQL Verification Team
Hello Ahmed taha,

Thank you for the bug report.
Could you please provide repeatable test case (exact steps, sample project, etc. - please make it as private if you prefer) to reproduce this issue at our end?

Regards,
Ashwini Patil
[31 Jan 2024 17:39] ahmed taha
my steps to hit the bug 
1 - create a simple .net application on client machine to connect to mysql remote server using ssl connection 
2 - install Net limiter on client machine and give the simple application limit to 5 kb or less 
3 - try to connect then the application will crash with no exception catch even if the connection code inside "Try Catch" statement
[16 May 12:38] MySQL Verification Team
Hello Ahmed,

Thank you for the details.
May I kindly request you to try latest version and report us back if you are still seeing this issue at your end.

Regards,
Ashwini Patil
[17 Jun 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".