Unable to acquire lock zxy.json immediately
Problem reported by L.T. - 3/2/2022 at 11:47 PM
Resolved
Version:
  1. Gleamtech.Common v5.0.0
  2. Gleamtech.DocumentUltimate v6.1.0
Full error message:
Unable to acquire lock 1hwqcio~xxgoqq~xxgoqq~nnurhs.json immediately
   at GleamTech.DistributedLocking.DistributedLockManager.Lock(Object requester, String name, Int32 timeoutSeconds, IDistributedLockProvider provider)
   at GleamTech.Caching.FileCache.Get(FileCacheKey cacheKey)
   at GleamTech.DocumentUltimate.AspNet.DocumentCache.LoadCacheInfo(FileCacheKey cacheInfoKey, Boolean throwIfNotExists, Boolean ignoreDeserializationErrors)
   at GleamTech.DocumentUltimate.AspNet.UI.DocumentViewerHandler.DownloadDocument(String stateId, String cacheInfoKey, String attachment)

This error shows up most of the time when 1) loading a converted Microsoft Excel file, 2) scrolling through the side pane (regardless of converted document type).

Any advise to prevent this error is appreicated. 
Cem Alacayir Replied
Employee Post
Hi,
 
Upon further investigation, the error is showing when document viewer was loaded with a height of at least 800px and has abt 10 thumbnails at the side pane.
It should not be about viewer height or thumbnail count.
The document is loaded partially when you scroll. So if you have a bigger document then the server will be called again when you navigate more pages.
 
The actual problem is in your file system.
Where is your DocumentCache location? Maybe you don’t have enough  NTFS permission (should be Modify) in your cache folder?
 
What is your project type? If it’s .NET Framework 4.x, you can also try this setting:
L.T. Replied
It should not be about viewer height or thumbnail count.
The document is loaded partially when you scroll. So if you have a bigger document then the server will be called again when you navigate more pages.
I observed the error only when the document viewer is of a certain height and not when I set the document viewer to say, 400px (instead of 800px). And having side pane visible or not seems to affect the frequency of this locking error. Also, when this error shows up, some of the thumbnails images was not showing up (ie. 3 out of 10 thumbnails is showing blank although i can still click on it to load the correct page of the main document)

If it was my file system permission, i would expect it show the error everytime i load the document and not sometimes and not when i set the height or side pane visible or not. Also, note that this is issue is reproducible in 3 different machines.

My DocumentCache location is just a temp folder under the project and it has all the required permission for writting to it.

My project is using ASP.Net forms version of the viewer with .Net Framework 4.7.2.

Setting "AlphaFileSystemEnabled" to false still shows the same error unfortunately. 

Cem Alacayir Replied
Employee Post Marked As Resolution
It seems, you have set value of DocumentUltimateWebConfiguration.CacheWaitTimeout property to 0 so you cannot acquire locks when there are multiple simultaneous requests (thumbnails in your case).

 Please leave it at default value (5 minutes).
 
This property does not effect performance so setting it to 0 is not useful.
L.T. Replied
Cool, thanks! We actually intended to set the CacheWaitTimeout property to 15 mins but a bug in the code does set that property to 0 instead. I fixed that and it does seems to be working much better now. Thanks for your help.
Rajan Kumar Replied

I’m experiencing the same issue. I’m using .NET and have set CacheWaitTimeout to 5 minutes, but I’m still getting the same error for the message files when viewing a document in Document Viewer.

Could you please suggest how I can fix this issue?

The error I’m receiving is:

Unable to acquire lock p2nlq~lxucvr~lxucvr~1lqp17k.json within 30 seconds.

I noticed that the error mentions a 30-second timeout, which doesn’t seem to correspond to the CacheWaitTimeout value. I have already increased CacheWaitTimeout to 5 minutes, but the issue still persists.

The issue is intermittent. The same file works successfully at times, but at other times I receive the lock timeout error while trying to view the document. Since I’m using .NET, could you please advise if there are any additional configuration settings or changes I should consider to resolve this intermittent locking issue?

Cem Alacayir Replied
Employee Post
The previous message says 

We actually intended to set the CacheWaitTimeout property to 15 mins but a bug in the code does set that property to 0 instead.
Did you check your code or config files (it can also be set in appSettings.json or Web.config).
Rajan Kumar Replied
Its set only one time while application is initialize.
DocumentUltimateWebConfiguration.Current.CacheWaitTimeout = new TimeSpan(0, 0, Convert.ToInt32(ConfigurationHelper.GetConfigurationValue(ConfigurationSettings.PreviewerCacheWaitTimeout), CultureInfo.InvariantCulture));
We have set this to 5 mins but still getting below error.
Unable to acquire lock p2nlq~lxucvr~lxucvr~1lqp17k.json within 300 seconds
Cem Alacayir Replied
Employee Post
You first said error says "30 seconds" but now you say it says "300 seconds" which is now correct (= 5 min).
Can you manually delete file p2nlq~lxucvr~lxucvr~1lqp17k.json  ?
Maybe due to a crash, the file handle was not closed so you can't overwrite it.
Restart your app to close file handle.

Try not changing/setting any DocumentUltimateWebConfiguration.Current.Cache* properties especially timing related ones because the default values usually work good.
Also I recommend you update your version (at least to last release of a major version), seems you are using an old version which may have some issues. For example in later versions, we added minimum value restrictions to Cache properties to prevent user misconfiguration.
https://docs.gleamtech.com/documentultimate/articles/version-history.html

Reply to Thread

Enter the verification text