I have a custom application that builds a Lucene Index on our various SQL Server VMs hosted in Azure (it runs locally on the machine. I know this isn't ideal, but reasons). This program has run flawlessly on multiple machines for years.
Recently we built a new VM using Windows Server 2016 and SQL Server 2016. Now the program seems to hang randomly when calling reader.read()
until I kill the process. This has never been an issue before, but the versions of Windows and SQL Server were mainly 2012 or lower before this.
When I run the application on a different machine and point it at the new SQL Server 2016 VM, it works fine. When I run the application locally on the new VM and point it at itself, it will fail. It will also fail if I point it at a previously working SQL Server while it runs locally on the new VM.
This almost makes me believe it's more of an issue with Windows 2016 and not SQL Server 2016.
This just uses the SqlCommand
class in pretty much the most basic way.
(I'm just typing this as an example, this is not the actual code).
using (SqlConnection connection = new SqlConnection("connection String"))
{
connection.Open();
using (SqlCommand cmd = new SqlCommand("query", connection)
{
connection.Open();
using (var reader = cmd.ExecuteReader())
{
// freezes here randomly
while (reader.read())
{
// do stuff
}
}
}
}
Besides freezing the only wait I get from SQL Server is mainly from 'Network I/O'. This is because SQL Server has processed the rows from the query, but the application suddenly starts to fail pulling them.
I've tried everything I can think of so If anyone has any suggestions, I would greatly appreciate it.