Symptoms
Assume that you use merge replication in Microsoft SQL Server 2012 or in Microsoft SQL Server 2014. As a part of the synchronization process, merge agent makes new generation in a session. If for some reason, such as a deadlock or time-out, the generation making transaction is selected as deadlock victim, and the transaction is rolled back, there may be a large chain of blocking for MSinternal_makegeneration_inprog application lock in the forthcoming generation makings, and the session previously mentioned is displayed as the head blocker.
Cause
The application lock that is used to help secure a generation making process is a session level application lock. When a deadlock is detected during generation making process, only the transaction is rolled back but session is not logged off. To release a session level application lock, the session must logoff. Therefore, because of the design of retry logic (session will not be logged off during generation making failure in merge replication), if the first generation making fails with deadlock, the session lock (MSinternal_makegeneration_inprog) it obtained, will not be released during transaction rollback. This causes blocking chain of lock requests in the forthcoming generation making process. The head blocker is displayed to be the first generation making request which fails with deadlock.
Before the hotfix, SQL Server only clears the lock for a successful generation making process. It leaves an orphaned session application lock before the session logoff if a deadlock happens.Resolution
This issue was first fixed in the following cumulative update of SQL Server.
Cumulative Update 5 for SQL Server 2014 /en-us/help/3011055
Cumulative Update 3 for SQL Server 2012 SP2 /en-us/help/3002049
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.