Thursday, 23 April 2015

Sitecore 7.5 SQL Session Deadlocks

Recently, I was getting this error in one of our Sitecore 7.5 instances:

ERROR Failed processing expired items. Session type: d027da82-f6a4-4275-bb09-8bd3732d828e

Transaction (Process ID 127) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

A lot...

Like 10 times a second...

The site uses SQL session state and has fairly high traffic. The problem is present in the initial release of Sitecore 7.5, but update-1 contains a simple fix. There is replacement provided for a misbehaving SQL stored procedure. The release notes state the following:
SQL Server transaction deadlocks related to the processing expired sessions could occur on high load. This has been fixed by changing the GetExpiredItemExclusive stored procedure in the Session database so that it now uses WITH UPDLOCK when reading from the Sessions table. (6602)

If you're so inclined, the stored procedure can be installed independently of the rest of the update. At least that will clear your logs up a bit.

Apart from that single line in the release notes, I couldn't find any other information on this error. So hopefully this post has given Google a few juicy keywords to latch on to.