Violation of PRIMARY KEY constraint `PK_Licenses`

Version 1

    Problem

    The following error can be found in the Windows Application Event Log of the RES Workspace Manager Relay Server:


    Source: RES Workspace Manager Relay Server
    Event ID: 0
    Task Category:  None
    Level: Error
    User: N/A
    Computer: FQDN_of_Relay_Server
    Description:
    The description for Event ID 0 from source RES Workspace Manager Relay Server cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    If the event originated on another computer, the display information had to be saved with the event.

    The following information was included with the event:

    Error:
    SqlError: if exists(SELECT * from tblLicenses where rowGUID = @LicenseId) BEGIN UPDATE tblLicenses SET [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], strLicenseType=case when upper(strLicenseType)=`SOFT` and upper(@LicenseType)=`HARD` then `SOFT` else @LicenseType end , [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] WHERE rowGUID = @LicenseId Select `update` as action, strLicenseType, imgInfo from tblLicenses where rowGUID = @LicenseId  END ELSE BEGIN INSERT INTO tblLicenses (rowGUID, AppGUID, strSessionStartUTC, strLastRefreshUTC, strLastUpdateUTC, strComputerName, strComputerNameLC, strComputerIP, lngSessionID, strClientName, strClientIP, strUser, strUserLC, strUserFull, strOU, strLicenseType, strProtocol, strAGStatus, strPFVersion, strSubscriberVersion, lngGuardianProcessID, strIdleStartUTC, lngConnectionState, strWorkspace, imgInfo, AgentGUID) VALUES (@LicenseId, @AppGuid, @SessionStartUTC, @LastRefreshUTC, @LastUpdateUTC, @ComputerName, @ComputerNameLC, @ComputerIP, @SessionId, @ClientName, @ClientIP, @User, @UserLC, @UserFull, @OU, @LicenseType, @Protocol, @AGStatus, @PFVersion, @SubscriberVersion, @GuardianProcessId, @IdleStartUTC, @ConnectionState, @Workspace, @XmlInfo, @AgentGuid) Select `insert` as action END (@LicenseId=GUID; @AppGuid=00000000-0000-0000-0000-000000000000; @SessionStartUTC=20141006074343; @LastRefreshUTC=20141006074405; @LastUpdateUTC=20141006074509; @IdleStartUTC=-; @ComputerName=DOMAIN\HOSTNAME; @ComputerNameLC=domain\hostname; @ComputerIP=x.x.x.x; @SessionId=0; @ClientName=hostname; @ClientIP=x.x.x.x; @User=DOMAIN\username; @UserLC=DOMAIN\username; @UserFull=Full Username; @OU=OU-GUID; @LicenseType=HARD; @Protocol=Local; @AGStatus=BLOCKING; @PFVersion=Version 9.7.5.0; @SubscriberVersion=; @GuardianProcessId=4000; @ConnectionState=1; @Workspace=workstation; @XmlInfo=System.Byte[]; @AgentGuid=GUID)

    Connection: Server: FQDN_of_Relay_Server, Database: WorkspaceManager : Violation of PRIMARY KEY constraint `PK_Licenses`. Cannot insert duplicate key in object `dbo.tblLicenses`. The duplicate key value is (d7adee5a-d0dc-4a98-89c6-8d45346cccd6).
    The statement has been terminated.

    Version: 9.7.5.0 (2012 SR5) CS:183759

    StackTrace:
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       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, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
       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.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       at RES.DataAccess.DbClient.BaseDbClient.TryExecuteReader(BaseDbClient dbClient, IDbCommand dbCommand, IDataReader& dbDataReader)

     

    Solution

    This issue is resolved in RES Workspace Manager 2014 SR3.

    In case the Service Release is not (yet) available or in case the Service Release cannot be installed, a revision containing this update is available on request at RES Support.

    IMPORTANT: A revision contains multiple fixes. Only apply this revision when you are experiencing a specific problem. Unless you are severely impacted by this specific problem, RES Software recommends that you wait for the next service release containing these fixes.