Inv / WIP Rec Lock Timeout

Hi all,

Our finance department is trying to do month end over the weekend, and we’re getting a Lock Timeout about 3.5 minutes into processing the report every time. I went and recycle the app pool, then tried fully stopping and restarting the app pool, no joy.

Currently trying to run it for different date ranges to see if I can at least isolate the date with the offending record. Any tips or tricks you guys have to fix this kind of issue? Kind of at a loss for what to do even if I find the date / record.

Update: Seems to be the same result no matter the date range. Single day, whole month, doesn’t matter. 3 minutes ish and lock timeout.

Full error message from the systask monitor:

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: An error occurred while executing the command definition. See the inner exception for details.
Stack Trace:
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
   at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
   at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at System.Data.Entity.Core.Objects.CompiledQuery.ExecuteQuery[TResult](ObjectContext context, Object[] parameterValues)
   at System.Data.Entity.Core.Objects.CompiledQuery.Invoke[TArg0,TArg1,TArg2,TResult](TArg0 arg0, TArg1 arg1, TArg2 arg2)
   at Epicor.Data.DBExpressionCompiler.GetResult[TContext,TQuery,TResult](Func`3 executeQuery, Cache cacheSetting, TContext dataContext, TQuery query) in C:\_Releases\ICE\ICE3.2.200.21\Source\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 445
   at Epicor.Data.DBExpressionCompiler.InvokeSingle[TContext,TQuery,TResult](Expression expression, Cache currentCacheSetting, Boolean cacheQuery, TContext dataContext, Func`2 getDataCacheKey, Func`2 compileQuery, Func`3 executeQuery) in C:\_Releases\ICE\ICE3.2.200.21\Source\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 306
   at Epicor.Data.DBExpressionCompiler.<>c__DisplayClass34_0`4.<Compile>b__0(TContext context, TArg1 arg1, TArg2 arg2) in C:\_Releases\ICE\ICE3.2.200.21\Source\Framework\Epicor.System\Data\DBExpressionCompiler.Generated.cs:line 1110
   at Erp.Internal.IM.IMR70.setTranRef(String TranType, Boolean useTempTable, String& TranRef) in C:\_Releases\ERP\UD10.2.200.21\Source\Server\Internal\IM\IMR70\IMR70.cs:line 3529
   at Erp.Internal.IM.IMR70.DoPartTranPosted() in C:\_Releases\ERP\UD10.2.200.21\Source\Server\Internal\IM\IMR70\IMR70.cs:line 3454
   at Erp.Internal.IM.IMR70.BuildTempTablePosted() in C:\_Releases\ERP\UD10.2.200.21\Source\Server\Internal\IM\IMR70\IMR70.cs:line 2339
   at Erp.Internal.IM.IMR70.RunProcess(Int64 instanceTaskNum, String outputFileName) in C:\_Releases\ERP\UD10.2.200.21\Source\Server\Internal\IM\IMR70\IMR70.cs:line 2019
   at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 98
   at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_Releases\ICE\RL3.2.200.0\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 57
   at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in C:\_Releases\ICE\ICE3.2.200.21\Source\Server\Services\Lib\RunTask\BpmFriendlyTaskLauncher.cs:line 63
   at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in C:\_Releases\ICE\ICE3.2.200.21\Source\Server\Services\Lib\RunTask\RunTask.cs:line 549
Inner Exception:
Lock request time out period exceeded.
Stack Trace:
   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, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, 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& usedCache, Boolean asyncWrite, Boolean inRetry)
   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 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)

Restarting the Sql Server service fixed the issue, thanks @knash!

2 Likes