ASP.NET MVC error : Object being referred to is not locked by any Client

TBA

When ever we try to update a user using an ASP.net MVC4 website, we get this error. Please help me to find out . This was working previously without any issue.

ErrorCode<ERRCA0012>:SubStatus<ES0001>:Object being referred to is not locked by any client.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode<ERRCA0012>:SubStatus<ES0001>:Object being referred to is not locked by any client.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[DataCacheException: ErrorCode<ERRCA0012>:SubStatus<ES0001>:Object being referred to is not locked by any client.]
   Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination) +551
   Microsoft.ApplicationServer.Caching.SocketClientProtocol.ExecuteApi(IVelocityRequestPacket request, IMonitoringListener listener) +287
   Microsoft.ApplicationServer.Caching.SocketClientProtocol.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener) +360
   Microsoft.ApplicationServer.Caching.DataCache.InternalPutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout, DataCacheTag[] tags, String region, IMonitoringListener listener) +216
   Microsoft.ApplicationServer.Caching.<>c__DisplayClass9d.<PutAndUnlock>b__9c() +160
   Microsoft.ApplicationServer.Caching.DataCache.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout) +276
   Microsoft.Web.DistributedCache.<>c__DisplayClass1c.<PutAndUnlock>b__1b() +52
   Microsoft.Web.DistributedCache.<>c__DisplayClass31`1.<PerformCacheOperation>b__30() +19
   Microsoft.Web.DistributedCache.DataCacheRetryWrapper.PerformCacheOperation(Action action) +208
   Microsoft.Web.DistributedCache.DataCacheForwarderBase.PerformCacheOperation(Func`1 func) +167
   Microsoft.Web.DistributedCache.DataCacheForwarderBase.PutAndUnlock(String key, Object value, DataCacheLockHandle lockHandle, TimeSpan timeout) +162
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +929
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Gaurav Mantri

Please check if your requests are not timing out. We also faced exact same issue in our project and we found this blog post really helpful in finding why we were running into this issue: http://www.anujvarma.com/session-storage-app-fabric-cache/.

One thing we initially did was increased the request timeout to 5 minutes (300 seconds) in web.config as mentioned in the blog post. However we only did it for the action where we knew we would encounter the timeout issue. To change the timeout for all actions, you could do something like below which was mentioned in the post:

<system.web>
    <httpRuntime executionTimeout = "300"/>
  </system.web>

Or you could do is increase the timeout for specific action:

  <location path="Controller/Action">
    <system.web>
      <httpRuntime executionTimeout="300"/>
    </system.web>
  </location>

IMHO, 2nd option is more preferable over the 1st one because you're targeting specific actions instead of your entire site.

However as mentioned in my comments as well, this is not really foolproof. Better alternative would be to optimize the code first so that your requests are not taking long time. In our case, we had a bad retry policy for storage operations and we fixed the issue by modifying that retry policy.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

mutable object referred by std::any

ASP.NET MVC Object reference error

The object referred to by string isn't being displayed

404 error for any action with asp.net core MVC

Newtonsoft Json.NET serialized object not being rendered properly in ASP.NET MVC View

Locked Textbox when add value in asp .net mvc

No parameterless constructor defined for this object error in asp .net MVC

Error in Service IUserStore being created in Identity Asp.net core 3 MVC

Internal Server Error being returned from ASP.NET MVC Action in Azure App Service Plan

Error handling in ASP .Net MVC

How to display error on the client when using ASP.NET MVC AJAX

Object Reference not set to an instance of an object? (Exception error ~ ASP.NET MVC)

ASP.NET MVC | DropDownListFor gives error Object reference not set to an instance of an object

NullReferenceException: Object reference not set to an instance of an object error in ASP.NET MVC

ASP.NET Core 6 MVC : data not being seeded

Asp.Net MVC How to log all actions being called

ASP.NET MVC elements only on homepage without being in container

Data are not being set in the model ASP.Net mvc

ASP.NET MVC5 model not being validated

ASP.NET MVC Dynamic Model not being recognized

Data being lost when updating database in ASP.NET MVC

Invalid object name (ASP.NET MVC)

ASP.NET MVC maintain object Session

Asp.net MVC EditorFor "The type 'System.Object' is defined in an assembly that is not referenced" error

Asp.net mvc error System.Data.SqlClient.SqlException: 'Invalid object name 'AspNetUsers'.'

Redirect to HTTPS Error - ASP.NET MVC

Dropzone error messages in ASP.NET MVC

ASP.NET MVC Ajax Error handling

Error renaming ASP.NET MVC project