SqlConnection.Open raises wrongly "error occurred during the pre-login handshake" due to thread starvation #3118
Labels
🐛 Bug!
Issues that are bugs in the drivers we maintain.
✔️ Triage Done
Issues that are triaged by dev team and are in investigation.
Describe the bug
SqlConnection.Open raises:
A connection was successfully established with the server, but then an error occurred during the pre-login handshake
When the process experiences thread starvation.
To reproduce
Use Azure SQL Database
Expected behavior
It should await long enough until the thread starvation condition disappears, or it should raise a proper exception.
Further technical details
Microsoft.Data.SqlClient version: 5.2.2
.NET target: .Net 8.0
SQL Server version: Azure SQL, Pool
Operating system: Ubuntu 24.04
Additional context
It is hard to reproduce; just thread starvation is not enough. Parameters should be fine-tuned, even
Console.Write
makes sense.Tested on 2 CPU / 8 Gb RAM VM; Azure SQL was in the same Region (Australia East).
The problem is happening here and there in PROD, but nobody usually analyses the correlation with thread starvation.
The text was updated successfully, but these errors were encountered: