I have a stored procedure on SQL Server 2005 doing a Serializable Transaction. Inside this transaction, it selects a table with rowlock. At the end of the procedure, after rollback/commit, it sets the transaction isolation level to Read Commited.
This procedure is running, different processes have concurrent access controlled by these constraints, but suddenly, after some time, some processes throw a Sql Exception:
The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions.
This is not predictable, it can happen early, or after an hour.
What can I do to solve this problem?