e-business software management software
business software















Business solutions for small business
Beyond ordinary accounting software
business software solutions

Technical Support Questions

business accounting software

 

File Corruption associated to Opportunistic Locking and Read Caching
on Microsoft Windows Networks

 

Summary

Improperly configured Windows networks can lead to data corruption in any file system database that uses ISAM technology, including ManageMore. Two Windows networking behaviors, opportunistic locking (on Windows servers) and read caching (on Windows clients) are the source of the corruption potential. This paper discusses these behaviors, their effects and what can be done to minimize the chances of data corruption on Windows networks when running ManageMore Business Software.

The information in this paper is compiled from the latest information regarding these issues from Microsoft's documentation, our own in-house testing and customer reports.

Contents

What is Opportunistic Locking?

Opportunistic locking is a Windows-specific mechanism for client/server databases to allow multiple processes to lock the same file while allowing for local (client) data caching to improve performance over Windows networks. Unfortunately, the default setting of the opportunistic locking mechanism that enhances the performance of one type of database also introduces data integrity issues for other database types.

Microsoft's documentation states "An opportunistic lock (also called an oplock) is a lock placed by a client on a file residing on a server. In most cases, a client requests an opportunistic lock so it can cache data locally, thus reducing network traffic and improving apparent response time. Opportunistic locks are used by network redirectors on clients with remote servers, as well as by client applications on local servers" and "Opportunistic locks are requests from the client to the server. From the point of view of the client, they are opportunistic. In other words, the server grants such locks whenever other factors make the locks possible.".

You can read more about opportunistic locking in Microsoft's documentation. Please see the Additional Reading section below for more information.

What is Read Caching?

Read caching is local caching of read data, sometimes referred to as read-ahead caching, on client (workstation) PCs. This type of caching is the default behavior of the Windows operating system to improve performance of client/server databases over Windows networks. The way it works is that workstations can read data from the server and keep a local copy of that data to reduce network traffic. As soon as that workstation writes any data, it should flush file buffers at that time, reread the data from the server and then commit the changes.

Problems with read caching usually occur if something unforeseen happens, such as a workstation crash, where data is not properly flushed from the workstation, which can lead to data corruption.

Microsoft's documentation states that "Under extreme conditions, some multi-user database applications that use a common data store over a network connection on a file server may experience transactional integrity issues or corruption of the database files and/or indexes stored on the server. This typically applies to some so-called "ISAM style", or "record oriented" multi-user database applications, not to a client/server relational system like SQL Server." and "A hazard of local caching is that written data only has as much integrity as the client itself for as long as the data is cached on the client. In general, locally cached data should be flushed to the server as soon as possible."

You can read more about read caching in Microsoft's documentation. Please see the Additional Reading section below for more information.

How Does This Affect Me?

Certain versions of the ManageMore Software use an ISAM database and thus are more susceptible to the effects of the default Windows read caching and opportunistic locking settings than client/server databases.

Reliable database operation on Windows Networks can be achieved using the provided that the network is properly configured.  You can use the information in this paper to set up your Windows network's opportunistic locking and read caching parameters or contact Intellisoft Technical Support.

Disabling opportunistic locking and read caching will have a performance impact on any database application, whether an ISAM database or client/server database is used, but it will not affect the data integrity of any database.

What Operating Systems are Affected?

All server computers running Windows operating systems in the NT/2000 family that host data files accessed by other Windows PCs need to have opportunistic locking disabled in order to minimize the chances of database corruption. The NT/2000 family OS list includes Windows NT, Windows 2000, Windows XP and Windows 2003 Server.

All workstation computers running Windows operating systems in the 9X family running applications that use data files hosted on NT/2000 family servers need to have read caching disabled in order to minimize the chances of database corruption. This includes Windows 98 and Windows ME.

Disabling Read Caching on Windows Workstations

All Windows operating systems in the 9X family that act as database clients for data files (meaning that they access data files stored on other Windows PCs) need to have read caching disabled in order to minimize the chances of database corruption. This includes Windows 98 and Windows ME.

The Windows registry entry that controls read caching on Windows network clients is:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\VREDIR

DiscardCacheOnOpen REG_BINARY 0 or 1
Default: 0 (not disabled)

To disable read caching, the value of DiscardCacheOnOpen must be set to 1.

You can verify (or change or add, if necessary) this Registry value using the Windows Registry Editor (regedit.exe).
If you do change this Registry value, you will have to reboot the PC to ensure that the new setting goes into effect.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to VxD
7. Click on the VREDIR entry on the left-hand side of Registry Editor

8. If the DiscardCacheOnOpen registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 1

9. If the DiscardCacheOnOpen value already exists but its value is not 1, double-click on DiscardCacheOnOpen to change its value to 1

10. If the DiscardCacheOnOpen entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > Binary value
12. Rename the value to DiscardCacheOnOpen
13. Double-click on DiscardCacheOnOpen to change its value to 1

Disabling Opportunistic Locking on Windows Servers

All Windows operating systems in the NT/2000 family that act as database servers for data files (meaning that data files are stored there and accessed by other Windows PCs) need to have opportunistic locking disabled in order to minimize the chances of database corruption. This includes Windows NT, Windows 2000, Windows XP and Windows 2003 Server.

There are 2 Windows registry entries that control opportunistic locking (oplocks) on Windows network servers:

1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters EnableOpLockForceClose
2. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters EnableOplocks

1. EnableOpLockForceClose

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

EnableOpLockForceClose REG_DWORD 0 or 1
Default: 0 (not disabled)

To disable oplocks, the value of EnableOpLockForceClose must be set to 1.

You can verify (or change or add, if necessary) this Registry value using the Windows Registry Editor (regedit.exe).
If you do change this Registry value, you will have to reboot the PC to ensure that the new setting goes into effect.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to LanManServer
7. Click on the Parameters entry on the left-hand side of Registry Editor

8. If the EnableOpLockForceClose registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 1

9. If the EnableOpLockForceClose value already exists but its value is not 1, double-click on EnableOpLockForceClose to change its value to 1

10. If the EnableOpLockForceClose entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > DWORD value
12. Rename the value to EnableOpLockForceClose 
13. Double-click on EnableOpLockForceClose to change its value to 1

2. EnableOplocks

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

EnableOplocks REG_DWORD 0 or 1
Default: 1 (true)

To disable oplocks, the value of EnableOplocks must be set to 0.

You can verify (or change or add, if necessary) this Registry value using the Windows Registry Editor (regedit.exe).
If you do change this Registry value, you will have to reboot the PC to ensure that the new setting goes into effect.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to LanManServer
7. Click on the Parameters entry on the left-hand side of Registry Editor

8. If the EnableOplocks registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 0

9. If the EnableOplocks value already exists but its value is not 0, double-click on EnableOplocks to change its value to 0

10. If the EnableOplocks entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > DWORD value
12. Rename the value to EnableOplocks 
13. Double-click on EnableOplocks to change its value to 0

Note: The location of the registry entry for opportunistic locking has changed in Windows 2000 from the earlier location in Microsoft Windows NT. In Windows 2000, the registry entry that disables opportunistic locking is:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters\

OplocksDisabled REG_DWORD 0 or 1
Default: 0 (not disabled)

To disable oplocks, the value of OplocksDisabled must be set to 1.

Note: Windows 2000 will still respect the EnableOplocks registry value used to disable oplocks in earlier versions of Windows.

Disabling Opportunistic Locking on Windows Workstations

All Windows operating systems in the NT/2000 family that act as database servers for data files (meaning that data files are stored there and accessed by other Windows PCs) need to have locking disabled in order to minimize the chances of database corruption. This includes Windows NT, Windows 2000 and Windows XP.

If you use a Windows NT/2000 family workstation in place of a server, you must also disable opportunistic locking (oplocks) on that workstation. For example, if you use a PC with the Windows NT Workstation operating system instead of Windows NT Server, Windows 2000 Professional instead of Windows 2000 Server, or Windows XP Home instead of Windows XP Professional, and you have data files located on it that are accessed from other Windows PCs, you will need to disable oplocks on that system.

The major difference is the location in the Windows registry where the values for disabling oplocks are entered. Instead of the LanManServer location, the LanManWorkstation location is used here.

There are 2 Windows registry entries that control opportunistic locking (oplocks) on Windows network workstations:

1.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters EnableOpLockForceClose

2.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters EnableOplocks

1. EnableOpLockForceClose

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters

EnableOpLockForceClose REG_DWORD 0 or 1
Default: 0 (not disabled)

To disable oplocks, the value of EnableOpLockForceClose must be set to 1.

You can verify (or change or add, if necessary) this Registry value using the Windows Registry Editor (regedit.exe).
If you do change this Registry value, you will have to reboot the PC to ensure that the new setting goes into effect.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to LanManWorkstation
7. Click on the Parameters entry on the left-hand side of Registry Editor

8. If the EnableOpLockForceClose registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 1

9. If the EnableOpLockForceClose value already exists but its value is not 1, double-click on EnableOpLockForceClose to change its value to 1

10. If the EnableOpLockForceClose entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > DWORD value
12. Rename the value to EnableOpLockForceClose 
13. Double-click on EnableOpLockForceClose to change its value to 1

2. EnableOplocks

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanManWorkstation\Parameters

EnableOplocks REG_DWORD 0 or 1
Default: 1 (true)

To disable oplocks, the value of EnableOplocks must be set to 0.

You can verify (or change or add, if necessary) this Registry value using the Windows Registry Editor (regedit.exe).
If you do change this Registry value, you will have to reboot the PC to ensure that the new setting goes into effect.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to LanManWorkstation
7. Click on the Parameters entry on the left-hand side of Registry Editor

8. If the EnableOplocks registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 0

9. If the EnableOplocks value already exists but its value is not 0, double-click on EnableOplocks to change its value to 0

10. If the EnableOplocks entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > DWORD value
12. Rename the value to EnableOplocks 
13. Double-click on EnableOplocks to change its value to 0

Persistent Data Corruption

If you have applied all of the settings discussed in this paper but data corruption problems and other symptoms persist, here are some additional things to check out:

  • Faulty network hardware, such as a single faulty network card, network cable, or network hub/switch, can cause symptoms similar to read caching and data corruption.
  • Consider upgrading workstations and servers which contain outdated versions of Microsoft's OS.  Some older service packs in certain versions of OS's have had known issues with file corruption that have since been corrected by Microsoft.

Editing the Windows Registry

Caution: The following warning appears in every Microsoft Knowledge Base article that discusses editing the Windows registry:

WARNING : You can edit the registry by using Registry Editor (Regedit.exe or Regedt32.exe). If you use Registry Editor incorrectly, you can cause serious problems that may require you to reinstall your operating system. Microsoft does not guarantee that problems that you cause by using Registry Editor incorrectly can be resolved. Use Registry Editor at your own risk.

Terms

  • ISAM
    Indexed Sequential Access Method is a file management system developed at IBM that allows records to be accessed either sequentially (in the order they were entered) or randomly (with an index).

Additional Reading

  • Section of the Microsoft MSDN Library on opportunistic locking: 
    Opportunistic Locks, Microsoft Developer Network (MSDN), Windows Development > Windows Base Services > Files and I/O > SDK Documentation > File Storage > File Systems > About File Systems > Opportunistic Locks, Microsoft Corporation.
    URL=http://msdn.microsoft.com/library/en-us/fileio/base/opportunistic_locks.asp
 

 





 


©Copyright Intellisoft Solutions Inc.  All rights reserved.
Legal Notices | Privacy Statement | Business Management Software | Site Map
 
Affiliate Sites   Business Web Resources