Violation of PRIMARY KEY constraint ''PK_tbl_Lock''

Looking through our Single-Server TF SP1 single-server install TFS Event Logs I noticed a few of these. Any ideas?

Violation of PRIMARY KEY constraint 'PK_tbl_Lock'. Cannot insert duplicate key in object 'dbo.tbl_Lock'.

Event Type: Error
Event Source: TFS Version Control
Event Category: None
Event ID: 3000
Date: 16/06/2007
Time: 3:38:22 PM
User: N/A
Computer: SERVER
Description:
TF53010: An unexpected condition has occurred in a Team Foundation component. The information contained here should be made available to your site administrative staff.
Technical Information (for the administrative staff):
Date (UTC): 16/06/2007 5:38:22 AM
Machine: RPTFS01
Application Domain: /LM/W3SVC/3/Root/VersionControl-3-128263771174741081
Assembly: Microsoft.TeamFoundation.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 4788
Thread Id: 196
Account name: DOMAIN\TFSBUILD

Detailed Message: TF14105: An exception occurred in the Team Foundation Source Control System.
Web Request Details
Url:http://SERVER:8080/VersionControl/v1.0/repository.asmx [method: POST]
User Agent: Team Foundation (TfsIntegrator.exe, 8.0.50727.762)
Headers: Content-Length=665&Content-Type=application%2fsoap%2bxml%3b+charset%3dutf-8&Accept-Encoding=gzip&Accept-Language=en-AU&Expect=100-continue&Host=rptfs01%3a8080&User-Agent=Team+Foundation+(TfsIntegrator.exe%2c+8.0.50727.762)&X-TFS-Version=1.0.0.0&X-VersionControl-Instance=e3b211c6-3045-4c31-8e2b-0759e338ef4e
Path: /VersionControl/v1.0/repository.asmx
Local Request: True
Host Address: address
User: DOMAIN\TFSBUILD [authentication type: NTLM]

Exception Message: Violation of PRIMARY KEY constraint 'PK_tbl_Lock'. Cannot insert duplicate key in object 'dbo.tbl_Lock'.
(null): Database Update Failure - Error 2627 executing INSERT statement for tbl_Lock
RPTFS01.TfsVersionControl..prc_PendEdit: Database Update Failure - Error 500004 executing EXEC statement for prc_iiLockItem
The statement has been terminated. (type SqlException)
SQL Exception Class: 14
SQL Exception Number: 2627
SQL Exception Procedure: prc_iiLockItem
SQL Exception Line Number: 44
SQL Exception Server: SERVER
SQL Exception State: 1
SQL Error(s):
SQL Error[1]: System.Data.SqlClient.SqlError: (null): Database Update Failure - Error 2627 executing INSERT statement for tbl_Lock
Class: 16
Number: 500004
Server: SERVER
Source: .Net SqlClient Data Provider
State: 1
Procedure: prc_iiLockItem
Line Number: 57
SQL Error[2]: System.Data.SqlClient.SqlError: SERVER.TfsVersionControl..prc_PendEdit: Database Update Failure - Error 500004 executing EXEC statement for prc_iiLockItem
Class: 16
Number: 500004
Server: SERVER
Source: .Net SqlClient Data Provider
State: 1
Procedure: prc_PendEdit
Line Number: 315
SQL Error[3]: System.Data.SqlClient.SqlError: The statement has been terminated.
Class: 0
Number: 3621
Server: SERVER
Source: .Net SqlClient Data Provider
State: 0
Procedure: prc_iiLockItem
Line Number: 44

Exception Data Dictionary:
HelpLink.ProdName = Microsoft SQL Server
HelpLink.ProdVer = 09.00.3054
HelpLink.EvtSrc = MSSQLServer
HelpLink.EvtID = 2627
HelpLink.BaseHelpUrl =http://go.microsoft.com/fwlink
HelpLink.LinkId = 20476


Exception Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.TeamFoundation.Server.SqlResourceComponent.execute(ExecuteType executeType, CommandBehavior behavior)
at Microsoft.TeamFoundation.VersionControl.Server.VersionControlSqlResourceComponent.execute(ExecuteType executeType, CommandBehavior behavior)
at Microsoft.TeamFoundation.Server.SqlResourceComponent.ExecuteReader()
at Microsoft.TeamFoundation.VersionControl.Server.VersionedItemComponent.PendEdit(Workspace workspace, String targetServerItem, Int32 Encoding, LockLevel lockLevel, IList warnings, Boolean silent)
at Microsoft.TeamFoundation.VersionControl.Server.ChangeRequest.PendChange(ExpandedChange expandedChange, VersionedItemComponent db, Workspace workspace, IPrincipal userPrincipal, Set`1 attempts, ArrayList successes, ArrayList warnings, ArrayList failures, Boolean silent)
at Microsoft.TeamFoundation.VersionControl.Server.ChangeRequest.PendChanges(IPrincipal userPrincipal, Workspace workspace, ChangeRequest[] requests, ArrayList& failures, Boolean silent)
at Microsoft.TeamFoundation.VersionControl.Server.Repository.PendChanges(String workspaceName, String ownerName, ChangeRequest[] changes, Boolean silent, ArrayList& failures)

For more information, see Help and Support Center athttp://go.microsoft.com/fwlink/events.asp.

[6813 byte] By [GrantHolliday] at [2008-1-7]
# 1

Hi Grant,

We'll take a look at this and get back to you. Are you experiencing any issues when using source control? You mentioned that you just found this in the event log.

-Matt

MatthewMitrikMSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 2

No issues in particular. We have a service that performs continuous integration and then copies the output of a build into a different folder and checks it into source control using the TFS OM.

The error only seems to appear when this occurs.

GrantHolliday at 2007-10-2 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 3

Do you have SP1 installed?

Thanks,

Bill

BillTutt-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 4
I don't think the fix for this made it into SP1.
RichardBergMSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...
# 5

I am experiencing issues with this error message.

I am currently attempting to merge some code from a branch back to its parent branch, and it gives me an error message " A database error occurred (SQL error 2627) > Violation of PRIMARY KEY constraint 'PK_tbl_Lock'. Cannot insert duplicate key in object 'dbo.tbl_Lock'.

I connected Sql Management Studio to our TFS DB Server and did some queries and there are some records in this table (with a WorkSpaceID associated to my workspace) that are related to the files that I am trying to merge into.

The event log on the server has several Logs that are similar to the following: (some parts are altered to not disclose server information)

TF53010: An unexpected condition has occurred in a Team Foundation component. The information contained here should be made available to your site administrative staff.
Technical Information (for the administrative staff):
Date (UTC): 7/25/2007 9:18:18 PM
Machine: SERVER NAME
Application Domain: /LM/W3SVC/3/Root/VersionControl-1-128298634514321292
Assembly: Microsoft.TeamFoundation.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 269604
Thread Id: 269724
Account name: DOMAIN ACCOUNT

Detailed Message: TF14105: An exception occurred in the Team Foundation Source Control System.
Web Request Details
Url: http://SERVER NAME:8080/VersionControl/v1.0/repository.asmx [method: POST]
User Agent: Team Foundation (devenv.exe, 8.0.50727.762)
Headers: Content-Length=601&Content-Type=application%2fsoap%2bxml%3b+charset%3dutf-8&Accept-Encoding=gzip&Accept-Language=en-US&Expect=100-continue&Host=SERVER NAME%3a8080&User-Agent=Team+Foundation+(devenv.exe%2c+8.0.50727.762)&X-TFS-Version=1.0.0.0&X-VersionControl-Instance=2941786f-bc92-4843-a323-5c31af05535b
Path: /VersionControl/v1.0/repository.asmx
Local Request: False
Host Address: 10.0.0.118
User: DOMAIN ACCOUNT [authentication type: NTLM]

Exception Message: Violation of PRIMARY KEY constraint 'PK_tbl_Lock'. Cannot insert duplicate key in object 'dbo.tbl_Lock'. (type SqlException)
SQL Exception Class: 14
SQL Exception Number: 2627
SQL Exception Procedure: prc_PendMerge
SQL Exception Line Number: 1340
SQL Exception Server: SERVER NAME
SQL Exception State: 1
SQL Error(s):

Exception Data Dictionary:
HelpLink.ProdName = Microsoft SQL Server
HelpLink.ProdVer = 09.00.1399
HelpLink.EvtSrc = MSSQLServer
HelpLink.EvtID = 2627
HelpLink.BaseHelpUrl = http://go.microsoft.com/fwlink
HelpLink.LinkId = 20476


Exception Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.HasMoreRows()
at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout)
at System.Data.SqlClient.SqlDataReader.NextResult()
at Microsoft.TeamFoundation.VersionControl.Server.VersionedItemComponent.PendMerge(Workspace workspace, MergeOptions options, List`1 mergeItems, VersionSpec versionSpecTo, ArrayList failures, ArrayList conflicts, ArrayList warnings, Boolean branch, Boolean silent)
at Microsoft.TeamFoundation.VersionControl.Server.GetOperation.Merge(IPrincipal user, Workspace workspace, ItemSpec source, ItemSpec target, VersionSpec from, VersionSpec to, MergeOptions options, LockLevel lockLevel, ArrayList failures, ArrayList conflicts, Boolean silent)
at Microsoft.TeamFoundation.VersionControl.Server.Repository.Merge(String workspaceName, String workspaceOwner, ItemSpec source, ItemSpec target, VersionSpec from, VersionSpec to, MergeOptions options, LockLevel lockLevel, Boolean silent, ArrayList& failures, ArrayList& conflicts)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

I am currently not able to merge my code from its branch back to its parent branch. Please advise.

nayrnayr at 2007-10-2 > top of Msdn Tech,Visual Studio Team System,Team Foundation Server - Version Control...

Visual Studio Team System

Site Classified