English

Problem: Cannot acquire a lock while accessing data on a file share using SMBv2

Description

When performing various workflows within ArcGIS for Desktop, users may experience the error that a lock cannot be acquired. If this data exists on a file share such as a Network Attached Storage (NAS) or other device using Samba over SMBv2, there may be a problem with the Windows SMB2 cache. Users may experience this issue when a program creates a file, such as a lock file, and then verifies the file exists immediately after creation.

Note: 
This issue does not affect file shares over SMBv3, as SMBv3 implements DrirectoryLeasing, which makes the metadata cache for SMB a coherent cache and renders the DirectoryCacheLifetime parameter, the root cause of this issue, obsolete.

Cause

This problem is due to an issue within the SMB2 Client Redirector cache. At the Windows Vista and Server 2008 release, three file metadata caches were implemented to speed up the return of the most recently accessed file and directory information. However, by default, at the Windows 7 and Server 2008 R2 releases, these caches are set to refresh every ten seconds. In the case of ArcGIS for Desktop lock creation, this cache regeneration is not fast enough.

For more information, see the following Microsoft TechNet article: SMB2 Client Redirector Caches Explained.

Solution or Workaround

To resolve this issue for ArcGIS for Desktop, the registry must be updated to disable the SMB2 caching. Alternatively, force the connection over SMBv3 if possible. 

  1. As the computer administrator, open the Start menu and type regedit.exe to open the Registry Editor.
  2. Navigate to the following registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Lanmanworkstation\Parameters
  1. Check to see if the name DirectoryCacheLifetime exists within the key.
  2. If the name does not exist, create a new 32-bit DWORD (right-click and select New > DWORD Value) and name it DirectoryCacheLifetime.
  3. Once the name DirectoryCacheLifetime exists, modify the DWORD value to be 0.
Image of the registry editor
Note:
Depending on the organization's privilege settings, the machine may need to be rebooted after making these registry changes.