You are viewing limited content. For full access, please sign in.

Question

Question

Violation of PRIMARY KEY constraint 'PK_cached_overdue_predictions' errors

asked on March 21, 2018

We recently started getting a number of primary key violations in our event logs.   Has anyone seen these before, know what the cached_overdue_predictions table is used for or how to correct this?  Everything 'seems' to be working fine on our Forms server otherwise.

 Violation of PRIMARY KEY constraint 'PK_cached_overdue_predictions'. Cannot insert duplicate key in object 'dbo.cached_overdue_predictions'. The duplicate key value is (294738, 0).

Thanks

 

The full error message:

Entity Framework returned the following error when trying to communicate with SQL Server: An error occurred while executing the command definition. See the inner exception for details.. [LFF18-EntityFrameworkInaccessible]

Details:
URL: 
Error: EntityFrameworkInaccessible
Date: 3/21/2018 10:58:49 AM (Mountain Standard Time)
HTTP Status Code: 500
Business Process ID: 0
Business Process Name: 

Stack Trace:
Caught exception: Laserfiche.Forms.CommonUtils.Exceptions.LFFormsException
Message: Entity Framework returned the following error when trying to communicate with SQL Server: An error occurred while executing the command definition. See the inner exception for details.. [LFF18-EntityFrameworkInaccessible]


Inner exception: System.Data.Entity.Core.EntityCommandExecutionException
Message: An error occurred while executing the command definition. See the inner exception for details.
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.Execute(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteNonQuery()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunctionCommand(EntityCommand entityCommand)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass4b.<ExecuteFunction>b__49()
   at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction(String functionName, ObjectParameter[] parameters)
   at Laserfiche.Forms.EntityModels.FormsEntities.GetCycleTimeOverduePrediction(Nullable`1 bp_id, Nullable`1 process_id, Nullable`1 step_id, Nullable`1 user_id, Nullable`1 hours_till_due, Nullable`1 hours_till_due_excluding_weekends, Nullable`1 history_id)
   at Laserfiche.Forms.CommonUtils.Predictions.FormsCycleTimeOverdue.RunPrediction()
   at Laserfiche.Forms.Routing.Prediction.UpdatePredictions(Object parameter)

Inner exception: System.Data.SqlClient.SqlException
Message: Violation of PRIMARY KEY constraint 'PK_cached_overdue_predictions'. Cannot insert duplicate key in object 'dbo.cached_overdue_predictions'. The duplicate key value is (294738, 0).
Violation of PRIMARY KEY constraint 'PK_cached_overdue_predictions'. Cannot insert duplicate key in object 'dbo.cached_overdue_predictions'. The duplicate key value is (294738, 1).
The statement has been terminated.
The statement has been terminated.
   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, Boolean describeParameterEncryptionRequest)
   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.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)



 

0 0

Replies

replied on March 21, 2018 Show version history

Hi Andrew,

The "cached_overdue_predictions" table is used for "Likely to be overdue" function on the operational report, which is introduced in Forms 10.3.0 (see what's new in Forms 10.3 ):

We are not sure why the issue would happen in your case. You may turn off the prediction service to avoid seeing this error in this way:

  • Edit db table cf_options, find the entry with optionname "EnablePredictions" and set the optionvalue to "false"
  • Then restart Forms Routing Service

Or you may open a support case and provide us your database if you would like to use this feature. Sorry for the inconvenience.

1 0
replied on May 22, 2019

Hi Rui,

I am also receiving this error and would like to disable this in the db. I can't find this option in the cf_options table, so I assume in version 10.4 this option may have been moved.

 

Do you know where I could find it by any chance?

You are not allowed to follow up in this post.

Sign in to reply to this post.