I have a problem where my query that has the DROP TABLE command causes DBCC SHRINKFILE to timeout.
We are using NHibernate as ORM and .NET. The Hangfire is used for the jobs.
The scenario is like this: Hangfire runs a job, in which all the queries are executed one by one. One of the commands is also a shrink file which timeout in the end because it is blocked by some implicit transaction in the background (which I cannot find :/) I found out that if I remove DROP TABLE command from one specific query, the problem no longer exists. I have tried to run the query and then shrink from SSMS, it executes without any problems. There is nothing suspicious in the table, and all the constraints are removed before DROP, the only thing is that the table has a lot of rows but from SSMS it drops the table in less than a second. Extending the statement timeout for the shrink did not help, I have tried to wait for 2+ hrs but without any results, it still timeout. When I try to search for the blocking transaction it all leads to the hangfire job, which is basically all the queries...
Does anyone have any idea how to trace why DROP TABLE from code causes SHRINKFILE to be blocked...?