Home » Documentation » Setup Options & Configuration » Disabling Opportunistic Record Locking

Documentation

Disabling Opportunistic Record Locking

How To Disable Opportunistic Locking

Microsoft introduced an operating system feature in Windows NT that caches file handles called RFCB Caching. This was done in order to increase the file handling performance of specific kinds of Windows based applications on an NT server (such as client/server based applications). This feature can cause problems in traditional shared databases, such as the TPS system used by Simple Accounting. (By the way, this is a problem for many database systems, including Microsoft’s own Access and Foxpro.)

Warning:  Highly Technical Explanation. Boredom Imminent!

NT Server service caches file handles (RFCBs) associated with files it has opened on behalf of a client (workstation) request. Although write requests proceed normally, close requests are acknowledged by the server, but are buffered from the file system. This is intended to optimize response time to repeated open/close operations performed by clients (which our database does a great deal of). Additionally, Opportunistic Locking (oplock) is an optimization that is a logical extension of the way a client caches its own file close request and relies on the server to arbitrate future requests for file access by other clients, rather than allowing the application to actually close it’s own file handles. In many situations, Oplocks must also be disabled for compatibility purposes. Because of Opportunistic Locking’s relationship with file closes, RFCB Caching and Opportunistic Locking go hand-in-hand. Microsoft presumes you will not be running traditional database applications on your new server and as a result, both of these potentially data corrupting features are activated by default upon installation of Windows NT Server.

An obvious sign that a file is being held open is the reported file size may be zero. In Control Panel, the Server option displays open files, when in fact, they are only open by the Server service in a cached mode. Other signs may include sharing violations or data and index file corruption, or at least an apparent lack of synchronization between the data at various workstations. Simple Accounting relies on the file handles actually being closed. Local file operations are not serviced by the server and are not subject to RFCB Caching.

 

Procedure

To disengage both opportunistic locking and RFCB Caching, make the following modifications using the Registry editor (REGEDT32.EXE in Windows NT Server 3.51, and REGEDIT.EXE in Windows NT Server 4.0).

To do this you will need to verify (and correct, if necessary) these NT Server parameters:

  • EnableOpLockForceClose REG_DWORD set to 1 (default=0)

  • EnableOplocks REG_DWORD set to 0 (default=1)

  • CachedOpenLimit REG_DWORD set to 1 (default=0)

 

DANGER! Only your qualified service representative should do this.

 

Step # 1

Choose: HKey_Local_Machine ->

System ->

Current Control Set ->

Services ->

LanmanServer ->

Parameters ->

 

If the value EnableOpLockForceClose exists, Double-click on it, or select it, then pull down “Edit” and choose DWORD ->

In DWORD Editor, Hex selected, enter the value 1

 

…or, if the value EnableOpLockForceClose does NOT exist, pull down “Edit” and choose Add value ->

Value name: EnableOpLockForceClose ->

Data type : REG_DWORD ->

Press OK ->

 

In DWORD Editor, Hex selected, enter the value 1

 

Step # 2

Choose: HKey_Local_Machine ->

System ->

Current Control Set ->

Services ->

LanmanServer ->

Parameters ->

 

If the Value EnableOpLocks exists, double-click on it, or select it, then pull down “Edit” and choose

DWORD ->

In DWORD Editor, Hex selected, enter the value 0

 

…or, if the value EnableOpLocks does NOT exist, pull down “Edit” and choose Add value ->

Value name: EnableOpLocks ->

Data type : REG_DWORD ->

Press OK ->

In DWORD Editor, Hex selected, enter the value 0

 

Step # 3

Choose: HKey_Local_Machine ->

System ->

Current Control Set ->

Services ->

LanmanServer ->

Parameters ->

 

If the value CachedOpenLimit exists, double-click on it, or select it, then pull down “Edit” and choose: DWORD ->

In DWORD Editor, Hex selected, enter the value 1

 

Or, if the value CachedOpenLimit does NOT exist, pull down “Edit” and choose:

Add value ->

Value name: CachedOpenLimit ->

Data type : REG_DWORD ->

Press OK ->

In DWORD Editor, Hex selected, enter the value 1

 

After these changes have been made, shut down your server and start it back up. These changes will not take effect until you do this!

 

Please check the following Microsoft KnowledgeBase articles for more information:

Q124916  Some Applications Fail When Writing To Windows NT

Q102967  REG: Server Service Entries, Part 1

Q219022 Improving Performance of MS-DOS Database Applications

Q216026 Server Optimization in RFCB Caching

 

Last Revision: 06.26.2012
x

Contact

How Can We Help?

Other Ways To Reach Us

Sending your message. Please wait...

Thanks for sending your message! We'll get back to you shortly.

There was a problem sending your message. Please try again.

Please complete all the fields in the form before sending.

x

Add this topic to your list of favorites?