That Opportunistic Locking thing. Calling Dave P

88 views
Skip to first unread message

Ian Boys

unread,
Dec 8, 2002, 10:30:05 AM12/8/02
to
Another user group had a question that stinks of opportunistic locking
problems. What we really need is a Dave P type FAQ to point people to a
solution. Any suggestions?


Stephen Quinn

unread,
Dec 8, 2002, 10:53:55 AM12/8/02
to
Ian

Why not just add to the bottom of the VFAQ
- If you can't find the answer here try searching http://www.google.com BEFORE asking in
comp.lang.clipper

<G>
--
HTH
Steve Quinn


Ian Boys

unread,
Dec 8, 2002, 11:07:52 AM12/8/02
to

"Stephen Quinn" <ste...@brutecom.com.au> wrote in message
news:asvps0$ua86p$1...@ID-88745.news.dfncis.de...

> Ian
>
> Why not just add to the bottom of the VFAQ
Didn't know I could. Also, I don't know the answer.

> - If you can't find the answer here try searching
http://www.google.com BEFORE asking in
> comp.lang.clipper

I know, love and trust comp.lang.clipper and I know that people are usually
very helpful here!

What I'm actually asking for is a little help for others, for me it's not
an issue. As it's not a problem I have resolved myself or can try out, I
would prefere to go to a trusted source where I know the issue has risen
before and I know there are people who have proven solutions. NOT entirely a
bad thing I hope.

Stephen Quinn

unread,
Dec 8, 2002, 11:23:01 AM12/8/02
to
Ian

> > Why not just add to the bottom of the VFAQ
> Didn't know I could. Also, I don't know the answer.

Ask Dave - I'm sure he's open to suggestions.

> I know, love and trust comp.lang.clipper and I know that people are usually
> very helpful here!

Well I don't know about the love part<g> - but the rest I will agree with

--
Steve Quinn


Ian Boys

unread,
Dec 8, 2002, 11:25:41 AM12/8/02
to

"Stephen Quinn" <ste...@brutecom.com.au> wrote in message
news:asvrih$tg2s6$1...@ID-88745.news.dfncis.de...
> Ian

> > I know, love and trust comp.lang.clipper and I know that people are
usually
> > very helpful here!
> Well I don't know about the love part<g> - but the rest I will agree with
Well, love is a bit strong, but, when I feel the need for a 5 minute rest I
have a browse here rather than a game of Solitare.


>
> --
> Steve Quinn
>
>


Klas Engwall

unread,
Dec 8, 2002, 9:04:11 PM12/8/02
to
Ian,

>Another user group had a question that stinks of opportunistic locking
>problems. What we really need is a Dave P type FAQ to point people to a
>solution. Any suggestions?

Yes, redirect those with that kind of problems to
<http://www.jsiinc.com/subc/tip1400/rh1447.htm>

Klas

-------
klas dot engwall at engwall dot com

Spammers, please use this address :-) mailto:postmaster@[127.0.0.1]

Dave Pearson

unread,
Dec 9, 2002, 3:18:28 AM12/9/02
to
* Stephen Quinn <ste...@brutecom.com.au>:

> Ian
>
> Why not just add to the bottom of the VFAQ
> - If you can't find the answer here try searching
> http://www.google.com BEFORE asking in comp.lang.clipper

The VFAQ has always gone two better, it has <URL:http://groups.google.com/>
mentioned at the *top* of the document.

--
Dave Pearson | OSLib - Timeslice release functions.
http://www.davep.org/ | eg - Norton Guide reader for Linux.
http://www.davep.org/clipper/ | weg - Norton Guide reader for Windows.
http://www.davep.org/norton-guides/ | dgscan - DGROUP scanner for Clipper.

Dave Pearson

unread,
Dec 9, 2002, 3:19:38 AM12/9/02
to
* Stephen Quinn <ste...@brutecom.com.au>:

> Ian
>
> > > Why not just add to the bottom of the VFAQ
> > Didn't know I could. Also, I don't know the answer.
> Ask Dave - I'm sure he's open to suggestions.

If someone will write and host a definitive guide to this issue I'll happily
link to it from the VFAQ. Witness the printing issue FAQ.

Gerald Drouillard

unread,
Dec 9, 2002, 7:10:08 AM12/9/02
to
Check out http://drouillard.ca/Tips&Tricks/Samba/Oplocks.htm for some advice
on tuning your file server for database applications.

Regards
------------------------------------
Gerald Drouillard
Drouillard & Associates
http://drouillard.ca

"Ian Boys" <Feddu...@spammer.Co.UK> wrote in message
news:asvoji$5br$1...@newsg3.svr.pol.co.uk...

Randal Ferguson

unread,
Dec 9, 2002, 1:55:01 PM12/9/02
to
Klas,

Thanks for the tips. I would like our install routine to make these
registry changes but is there any danger by making these registry changes on
a computer running Win95/98/ME as I have no way of knowing what version of
Windows they may be using?

Thanks,
Randal Ferguson

"Klas Engwall" <klas.e...@nospam.please> wrote in message
news:3df3f870...@nntpserver.swip.net...

Stephen Quinn

unread,
Dec 9, 2002, 5:08:29 PM12/9/02
to
Randal

Depends on which installer software your using.

Wise has methods for testing for NT/W9x.

--
HTH
Steve Quinn


Dave Pearson

unread,
Dec 10, 2002, 8:23:45 AM12/10/02
to
* Dave Pearson <davep...@davep.org>:

> If someone will write and host a definitive guide to this issue I'll
> happily link to it from the VFAQ. Witness the printing issue FAQ.

Nick has done <URL:http://www.witzendcs.co.uk/html/nt_networking.html> so it
would appear that we have an "answer". Now that we've got an "answer",
what's the question?

Ian Boys

unread,
Dec 10, 2002, 8:57:01 AM12/10/02
to
Surely what we're aiming at is for any new question posted to the group we
have a standard reply that says "Look at DaveP's FAQ's"

But, seriously, since there seemed to be only one obscure comms on '98
problem that I seem to be able to help with, when I saw a problem on another
news group it seemed to be a good candidate for your FAQ's. Which, by the
way, are much appreciated.


"Dave Pearson" <davep...@davep.org> wrote in message
news:slrnavbqn1.p...@hagbard.davep.org...

Dave Pearson

unread,
Dec 11, 2002, 4:26:17 AM12/11/02
to
[Quotes rearranged to have a more logical flow]

* Ian Boys <Feddu...@spammer.Co.UK>:

> "Dave Pearson" <davep...@davep.org> wrote in message
> news:slrnavbqn1.p...@hagbard.davep.org...
>

> > Nick has done <URL:http://www.witzendcs.co.uk/html/nt_networking.html>
> > so it would appear that we have an "answer". Now that we've got an
> > "answer", what's the question?
>

> But, seriously, since there seemed to be only one obscure comms on '98
> problem that I seem to be able to help with, when I saw a problem on
> another news group it seemed to be a good candidate for your FAQ's. Which,
> by the way, are much appreciated.

Thanks. So, now that Nick has been kind enough to provide a resource that
gives answers about the problem you raised, what do you think the question
is that it answers? How best do you, or anyone else, think the question can
be posed in the VFAQ such that people who go searching will find the link?

Ian Boys

unread,
Dec 12, 2002, 3:10:58 PM12/12/02
to
This is a bit like one of those make up a headline competitions (that I was
never very good at).

Working on the cake principal, the ingredients list should contain:

Windows NT/Windows 2000 server

Database

Problems/anomalies/discrepancies

Opportunistic locking

How about:

Database problems on Windows NT/Windows 2000 server due to opportunistic
locking and how to deal with it.


"Dave Pearson" <davep...@davep.org> wrote in message

news:slrnave15p.p...@hagbard.davep.org...

AUGE_OHR

unread,
Dec 12, 2002, 7:20:04 PM12/12/02
to
hi,

this is a paper we got at last Xbase++ Devcon :

*****
Opportunistic locking

This article is about opportunistic locking, a little
known protocol of the LAN Manager of MS Windows NT/2000
and XP designed to increase performance of network
application - in theory!

However this protocol imposes a couple of problems
for Xbase++/Clipper and even MS Access or Excel
applications running in a shared network environment.

In this article I would like to explain the basic idea
of oplocks, which problems they implicate for network
applications and, last but not least, various strategies
how to increase performance and reliability of your
network application.

What is opportunistic locking

Opportunistic locks (oplocks) are a characteristic of the
LAN Manager networking protocol implemented in the 32-Bit
Windows family of operating system environments. Bascially,
oplocks are guarantees made by a server for a shared logical
volume to its clients. These guarantees inform the Client
that a file's content will not be allowed to be changed
by the server, or if some change is imminent, the client
will be notified before the change is allowed to proceed.

So much about the theory, in practice the LAN Manager introduces
with oplocks an additional protocol on top of the well known
standard file-system level locking protocol. This
is done for performance reasons. Only with oplocks the server
and its clients are allowed to cache data (read ahead) or
defer writes to a file (write behind). In other words, oplocks
are introduced to synchronize the data in an environment of multiple
workstations, each of which having their own local cache, sharing
a file via a file-server. Remember, any workstation has its own cache
to increase performance when it comes to file I/O. Imagine
a situation where 2 workstations read data (into their local
cache) and a single workstation writes data back. As a matter
of fact, one workstations cache is out-of-date and holds
"old" data. With oplocks the local cache of workstation
2 gets informed about the fact of modification by other workstations
and therefore invalidates its local cache.

The problem with oplocks is that they:

o are designed for file-sharing with medium concurrency
o introduce a additional level of overhead
o block clients from performing their operations immediately.

In practice the oplocks introduced by Microsoft are good enough
when it comes to sharing files like word-documents or excel
spreadsheets in a networking environment. But they fail when it
comes to heavy concurrency in enviroments with file-based databases
such as Xbase++, Visual FoxPro and even MS-Access or VB applications
with the Jet-Engine. There are other strategies available, such as
the ones implemented with the Andrew's file-system which deal with
the problem of distributed caches in a network, but for whatever
reason Microsoft has decided to go their own route.

The reason for the problems the oplock approach has with file based
database systems lies in their specific characteristic how they
deal with the file-system. File based database systems:

o impose a heavy concurrency and high propability of data
changes anywhere in the file.

o handle concurrency issues on their own at the semantical
layer of the database. Not on the file-based level. Remember
they lock records, ensure that updates get not lost using
sophisticated implicit and explicit locking protocols.

o implement specialized local optimization strategies to
handle caching of data and invalidation of cached data. All
based on the record or index-page level.

This is where the universal oplock solution with Microsoft LAN Manager
and file-based databases conflicts and can serious hamper them
in terms of performance and reliability. Even deadlocks produced
by the LAN Manager become possible with high concurrency due to its
restricted handling of so called worker threads in the context of oplocks.

With Windows for Workgroups, IBM LanManager and Novell Netware oplocks
problems
do not exist bec. these LAN operating-systems resolve the problems
differently or simply have not implemented a optimization strategy such
as the one introduced by the oplocks under Microsoft LAN Manager.


Which applications may be affected!

In general database application but also office applications
when online collaboration is enabled are affected by the oplock
problem when using Windows NT/2000 and XP as the file server.
Since Windows NT 4.0 Service Pack 4, 5, 6, or 6a and Windows 2000
a default oplock configuration which is critical to all types of
applications which run in a environment of heavy concurrency
was introduced.

Not affected:
- Windows NT 4.0 with Service Packs prior of #4
- Windows ME/98/95

Affected:
- Windows NT 4.0 with Service Pack 4 or higher
- Windows 2000
- Windows XP

At best your network performance is sluggish, at worst you
encounter problems with an open file shared by the LAN Manager
such as:

- The file is in use
- The file is already open
- Unable to write to drive U:
- The network drive U: is no longer available
- Data loss
- Data corruption - file size inconsistency


How Microsoft reacts to this issue?

You can find various MS Knowledgebase articles about this issue. MS
has officially confirmend that the default oplock configuration is
a problem for "DOS" style database applications. However,
understanding the Microsoft terminology is critical here:

1. The term "older MS-DOS-based database applications" refers to
all file-based database applications. Because they perform a so
called heavy concurrency pattern.

2. MS has no strategic interest in resolving this problem, specifically
in the context of the MS-Access and Jet-DatabaseEngine users community.
Because now they can talk them into using MS-SQL Server instead of
resolving the performance and reliability problems.

The following MS Knowledgebase articles are of interest to the
entire subject:

Q219022 Improving Performance of MS-DOS Database Applications
Because Xbase++ database engines in the context of Clipper/Comix
and SIX interoperability behave against the file system
such as a MS-DOS database application this article is valid
for DBF/NTX/CDX drivers et al.

Q129202 Explanation of Opportunistic Locking on Windows NT
This article describes additional configuration parameters
regarding oplocks. The article is valid for NT/2000 and XP.

Q163525 Delay When Saving Word File to Windows NT 4.0 Server
Even MS Word and other Office applications may run into performance
problems with the oplock solution by Microsoft.


Q126026 Server Optimization in RFCB Caching
If you have encountered problems when opening files located
on a server. This article describes how to detect if the
problem is related to oplocks and the CachedOpenLimit
configuration parameter.

Q249799 Slow Network Performance with Service Pack 4, 5, 6, or 6a
Valid for Xbase++/Clipper file-based database applications.

Q163525 Delay When Saving Word File to Windows NT 4.0 Server
FYI: Office 2000 has problems with oplocks too! You are not
alone!


What to do?

The simplest way to resolve problems related to oplocks is
to disable them on behalf of the LAN Manager server.

This is done by manipulating the following registry key:

\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet
\Services\LanmanServer\Parameters

EnableOplocks REG_DWORD 0 or 1
Default: 1 (true)
Specifies whether the server allows clients to use oplocks on
files. Oplocks are a significant performance enhancement, but
have the potential to cause lost cached data on some networks,
particularly wide-area networks.

By default, the registry entry is 1 (oplock enabled), as a rule
of thumb you should set this key to 0 (disable oplock) when sharing
files with Xbase++/Clipper/FoxPro and MS-Access. We have not
encountered any performance drawbacks in real-world scenarions
after having disabled oplocks. However problems with Xbase++
file-based database applications simple went away after
re-configuration of the server.


Summary

Opportunistic locks where introduced by Microsoft to increase performance
of network applications when it comes to file sharing. The strategy used
significantly decreases performance of file-based database applications.
The oplock can easily and safely be disabled via a registry-key setting
change.
After disabling of oplocks your database application should show
increased performance and higher reliability. Other applications may but
typically do not encounter performance penalities. The only potential
drawback of disabling oplocks is a potential higher bandwidth usage when
it comes to standard file usage such as opening/closing/reading/writing
office
documents.

*****

greetings by OHR
Jimmy


Dave Pearson

unread,
Dec 13, 2002, 4:24:24 AM12/13/02
to
[Quotes rearranged to have a more logical flow]

* Ian Boys <Feddu...@spammer.Co.UK>:

> "Dave Pearson" <davep...@davep.org> wrote in message

> news:slrnave15p.p...@hagbard.davep.org...
>
> > [SNIP] How best do you, or anyone else, think the


> > question can be posed in the VFAQ such that people who go searching will
> > find the link?
>

> [SNIP]


>
> How about:
>
> Database problems on Windows NT/Windows 2000 server due to opportunistic
> locking and how to deal with it.

The main problem I'd see with that is the talk of "opportunistic locking".
Presumably someone who knows that the cause of their problems is
"opportunistic locking" is well on the way to finding a solution.

Would it make more sense to be something like "I'm experiencing odd database
problems when using Windows NT/2000 as my server, what can I do?".

Also, does Windows XP not figure in this?

Ian Boys

unread,
Dec 13, 2002, 5:11:53 AM12/13/02
to
I agree but including opportunistic locking could A. Get people to read it
to find out about it before they know they have a problem, and B. Give
people a better handle to find it if they have a bit of a clue but need to
find a Clipper related definitive answer.

I'm not brave enough to use XP Pro workstation (it's on my kids PC's and
it'll be nice when it's finished), is anybody using XP server!

"Dave Pearson" <davep...@davep.org> wrote in message

news:slrnavj9q8.p...@hagbard.davep.org...

Dave Pearson

unread,
Dec 13, 2002, 5:42:10 AM12/13/02
to
* Ian Boys <Feddu...@spammer.Co.UK>:

> I agree but including opportunistic locking could A. Get people to read it
> to find out about it before they know they have a problem, and B. Give
> people a better handle to find it if they have a bit of a clue but need to
> find a Clipper related definitive answer.

Hmm, ok. I was sort of looking for a question that people might search for
and/or read and go "ahh, yes, that's my question, that's what I'm wondering
about when <problem> happens". Personally I'm not certain what <problem> is
or how it can be asked as a in-a-nutshell question.

Regarding searching, yes, I get quite a lot of hits on the copy of the VFAQ
my web site from various search engines where people have searched for the
only information they have to hand. Stuff like "runtime error r6003" and
"internal error 8002" crops up quite a bit. My point is, are people
experiencing <problem> likely to search for "opportunistic locking" or are
they far more likely to search for "runtime error 766613"?

> I'm not brave enough to use XP Pro workstation (it's on my kids PC's and
> it'll be nice when it's finished), is anybody using XP server!

Nick tells me that it is an XP issue too (thanks Nick).

Klas Engwall

unread,
Dec 13, 2002, 8:52:55 PM12/13/02
to
Dave,

>Hmm, ok. I was sort of looking for a question that people might search for
>and/or read and go "ahh, yes, that's my question, that's what I'm wondering
>about when <problem> happens". Personally I'm not certain what <problem> is
>or how it can be asked as a in-a-nutshell question.

I am not sure if it fits in a nutshell <g>, but it should be possible
to destill some kind of question to the already existing answer from
the preamble of the MS support article Q224992 at
<http://support.microsoft.com/default.aspx?scid=kb;en-us;Q224992>
which says:

"Under extreme conditions, some multiuser 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" multiuser
database applications, not to a client/server relational system like
SQL Server."

So I suppose the main keywords are "data corruption" and "index
corruption" although EnableOplocks is only one of the answers to the
corruption questions. And the oplock related corruption primarily
happens when a workstation has made a half-cached, half-commited
update and then crashes without flushing the rest of the cache.

But there can also be performance problems due to opportunistic
locking being enabled. This is what happens when one workstation has
an opportunistic lock on a file (the whole file is then locked!) and
another workstation needs to write to it:

Workstation 1: "Hey, Server, I need to write to file xxx"
Server: "Hold on, Workstation 2 has a lock on it"
Server: "Hey, Workstation 2, someone else needs to write to that file
I am locking for you"
Workstation 2: "Wait a minute, I am still working on this ... (flush,
flush) ... OK, I'm done. You can release my lock now"
Server: "OK, Workstation 1, the previous lock has been lifted and I
have locked the file for you so you can write to it now"

And all this negotiating plus the requested action by some other more
or less busy workstation takes time. So an additional key phrase would
perhaps be "performance problems writing to a shared file".


The reg files and problem descriptions at Nick's networking page (by
the way, Nick, may I suggest that you add links to the related Q
documents?) cover several additional problems besides opportunistic
locking. The main ones are that files are being cached after an
application has closed them so they sometimes can't be opened again
until the file cache has timed out (CachedOpenLimit) and that network
drives get disconnected after a few minutes of workstation inactivity
(AutoDisconnect).


The description of the CachedOpenLimit problem in MS support article
Q124916 at
<http://support.microsoft.com/default.aspx?scid=kb;EN-US;124916> is:

"Some applications running from a Windows for Workgroups or LAN
Manager client fail when they attempt to write to a file located on a
Windows NT version 3.5 server (whether it is a Windows NT Server
version 3.5 or a Windows NT Workstation version 3.5 machine acting as
the server). The application may report this error in various ways,
such as reporting a sharing violation, reporting that they cannot
write the file, and so forth."

The keywords here would be something like "access denied" and "sharing
violation". The problem occurs frequently when the previous user
and/or the new user opens the file in exclusive mode, and I have seen
it persisting for up to an hour on an unpatched server. For some
reason still only NT 3.x is mentioned in the article although it
applies also to later versions.


The description of the AutoDisconnect problem in MS support article
Q297684 at
<http://support.microsoft.com/default.aspx?scid=kb;EN-US;297684> is:

"When you perform drive mapping from a Windows 2000-based client
computer to either a Microsoft Windows NT or Windows 2000 network
share, the drive mapping may be disconnected after 15 minutes of
inactivity and Windows Explorer may display a red "X" on the icon of
the mapped drive. However, if you attempt to access or browse the
mapped drive, it reconnects quickly."

This may cause file() and the various file opening functions to fail
intermittently and report "file not found" or even "path not found"
although a retry of the same function a fraction of a second later may
work because the first try causes reconnection of the drive.

It looks like we need a coconut shell <g>

Nick Ramsay

unread,
Dec 14, 2002, 5:21:18 AM12/14/02
to
On Sat, 14 Dec 2002 01:52:55 GMT, klas.e...@nospam.please (Klas
Engwall) wrote:

>Dave,
>
>>Hmm, ok. I was sort of looking for a question that people might search for
>>and/or read and go "ahh, yes, that's my question, that's what I'm wondering
>>about when <problem> happens". Personally I'm not certain what <problem> is
>>or how it can be asked as a in-a-nutshell question.
>

[snip]


>
>The reg files and problem descriptions at Nick's networking page (by
>the way, Nick, may I suggest that you add links to the related Q
>documents?) cover several additional problems besides opportunistic
>locking. The main ones are that files are being cached after an
>application has closed them so they sometimes can't be opened again
>until the file cache has timed out (CachedOpenLimit) and that network
>drives get disconnected after a few minutes of workstation inactivity
>(AutoDisconnect).
>

Thanks for doing the research for me, Klas ;-) Links are now in place.

Comora

unread,
Dec 22, 2002, 10:42:45 AM12/22/02
to
Hello to All

I have the next problem:

First I have a network with 25 cpus runnig W98,WXP,Linux+DosEmu with
Telnet the server is RH7.3 with Samba 2.2.7a and 1 workstation with
RH73+Samba 2.2.7a+DosEmu connecting to the networks via mount and
smbmount.

This ws was installed last and we get corrupted index and dbfs without
records this only occours with de workstation that has RH73+Samba and
Dosemu.

We run the NetPerf without the offending ws and it runs ok without any
errors but when we instal the bad ws and run the program first on all
the others ws the bad ws does not recognize that the dbfs are open if
we run first in the bad ws the other do recognize that the dbfs are
open.

What can we do to correct this problem ?

Thanks in Advance
Ramiro Corona

Gerald Drouillard

unread,
Dec 22, 2002, 1:17:05 PM12/22/02
to
Can we have a look at your smb.conf file on the server please?

Regards
------------------------------------
Gerald Drouillard
Drouillard & Associates
http://drouillard.ca

"Comora" <rc...@hotmail.com> wrote in message
news:8c2ce275.02122...@posting.google.com...

Comora

unread,
Dec 22, 2002, 5:28:49 PM12/22/02
to
At this moment i am at home and the smb.conf file is at the office i
will post it tomorrow.

One thing we used the smb.conf default of samba 2.2.3a and after
installing the samba 2.2.7a added lock spin count = 50 and lock spin
time = 15 and thats all the changes made to the smb.conf but i will
still post it tomorrow.

António

unread,
Dec 23, 2002, 8:02:31 AM12/23/02
to
Ramiro,

> What can we do to correct this problem ?

I would first check for a fault in the network card.

HTH
António Vila-Chã
Viana do Castelo
Portugal

Reply all
Reply to author
Forward
0 new messages