Backend Development 8 min read

Debugging a .NET Login Hang Caused by MySQL SSL Connection Using WinDbg

An engineer troubleshoots a .NET application login freeze by capturing a dump with WinDbg, discovers the thread blocked in MySQL SSL handshake, verifies the MySQL driver version, and resolves the issue by disabling SSL via the connection string, illustrating effective debugging without source code or logs.

IT Services Circle
IT Services Circle
IT Services Circle
Debugging a .NET Login Hang Caused by MySQL SSL Connection Using WinDbg

Background

This case is special because the usual dump analysis is performed with software engineers, but this time the interaction was with a non‑technical person, requiring great patience to guide the dump capture and problem solving.

Storytelling

A friend contacted the author via WeChat saying the MES system they purchased showed an exception on login. The friend wanted the author to verify the company's claim that the issue was network‑related, even though the project had already been accepted.

WinDbg Analysis

Is it really a network issue?

Without source code or logs, the best approach is to capture a dump, which can still reveal the problem. The friend captured a dump when the program hung on login, and the author examined it to see if the network was indeed the cause.

Because the program hung, a thread was waiting on something; we can use ~*e !clrstack to view all thread stacks.

0:000:x86> ~*e !clrstack
... (stack output omitted for brevity) ...
OS Thread Id: 0x2094 (14)
Child SP       IP Call Site
0f94e888 0000002b [GCFrame: 0f94e888]
0f94e938 0000002b [HelperMethodFrame_1OBJ: 0f94e938] System.Threading.Monitor.ObjWait(Boolean, Int32, System.Object)
... 
0f94ead0 6b53d7b6 System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken) [f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs @ 3167]
0f94eae0 1468ae6b MySql.Data.Common.Ssl.StartSSL(System.IO.Stream ByRef, System.Text.Encoding, System.String)
0f94eb38 14687a55 MySql.Data.MySqlClient.NativeDriver.Open()
0f94ec04 14686e63 MySql.Data.MySqlClient.Driver.Open()
0f94ec28 14686ac7 MySql.Data.MySqlClient.Driver.Create(MySql.Data.MySqlClient.MySqlConnectionStringBuilder)
0f94ec50 146869ec MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
0f94ec58 14686957 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
0f94ec8c 146863e9 MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
0f94ecac 146862ca MySql.Data.MySqlClient.MySqlPool.GetConnection()
0f94ece0 146817c1 MySql.Data.MySqlClient.MySqlConnection.Open()
0f94ed18 0ca28753 xxx.GetMySqlConnection()
... 
0f94efec 0ca21902 xxx.UserLogin(System.String, System.String)
... 
0f94f4ac 6b4ae9db System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() [f:\dd\dp\clr\src\BCL\system\threading\threadpool.cs @ 1161]
0f94f6cc 6c500556 [DebuggerU2MCatchHandlerFrame: 0f94f6cc]
...

From the stack we see that thread 14 is inside the xxx.UserLogin method (the login button logic) and is waiting in MySql.Data.Common.Ssl.StartSSL , indicating a timeout there.

Usually MySQL on an internal network does not require an SSL certificate, so we next verify whether the MySQL instance is internal or external by running !dso to view the connection string.

The connection string contains the 192.168 prefix, confirming it is an internal address, so the unexpected SSL handshake is suspicious.

Does it really need SSL?

About three to four years ago, the author encountered a similar issue after upgrading a project to MySQL 8.0 via NuGet, which caused an authorization error.

We verify the MySQL .NET driver version using lm :

0:014:x86> lm
start    end        module name
... 
12b40000 12ca6000   MySql_Data   (deferred)
    Image path: C:\Users\xxxx\MySql.Data.dll
    Image name: MySql.Data.dll
    ...
    File version: 8.0.29.0
    Product version: 8.0.29.0
    ...
    ProductName: MySql.Data.Core
    ...
    Comments: ADO.Net driver for MySQL for .Net Framework and .Net Core

The Product version shows 8.0 , confirming the driver version. We then add SslMode=None to the connection string, for example:

<add key="上报平台1" value="mysql|Database = drp; Data Source = 192.168.xx.xx; port = 3306; User Id = xxx; Password = xxx;SslMode=None" />

After informing the friend, the issue was resolved the next day.

The friend then made a bold change by disabling MySQL's hava_openssl . Although this has a large impact, a smaller side‑effect change (adding the suffix) would have been sufficient, and the problem was solved.

Conclusion

Overall, the problem is simple for a developer, but accurately locating the issue without source code or logs when communicating with a non‑developer is a challenging task.

debuggingMySQLssl.NETWinDbgConnectionString
IT Services Circle
Written by

IT Services Circle

Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.