Solved

VFP9 Server Can't lock file

Posted on 2014-12-05
22
112 Views
Last Modified: 2016-02-19
Hi
After several years of plain sailing, I've twice this week had the server (Windows 2008) fail to lock the same file file in a VFP9 application. This happened a few years ago and the solution was to reboot the server--worked then and worked now, but I am concerned that it has happened twice now in a week. Is there anything I should be looking at? This is happening on one particular PC (all W7 Pro).
Thanks!
0
Comment
Question by:terrypba1
  • 7
  • 5
  • 4
  • +2
22 Comments
 
LVL 1

Accepted Solution

by:
Rob-Nilsen earned 170 total points
ID: 40483394
As a Visual FoxPro 9 developer/user I have seen things like this happen. VFP9 is pretty darn stable, but occasionally "environment" issues can interfere. Here are some thoughts based on my experience:

1) A file lock will not be able to be obtained if some other process/user is touching the file (reading or writing). For instance, I've seen this happen when multiple instances of the same program are launched (accidentally).
2) Antivirus programs can interfere with FoxPro's ability to lock a file. I currently have an open case with our antivirus vendor over issues that magically appeared after their latest engine update.  :-(
3) The server's SCSI/RAID controller configuration can affect how long file handles are held open. (FoxPro may think a file is closed, but the server still has a handle open to it.)

Is it possible that any of these factors are at play?
0
 

Author Comment

by:terrypba1
ID: 40483504
Thanks Rob-
1. This is a file that is only updated by one user on a 20 user system--pretty sure no one else was running that program. The file itself is rarely accessed otherwise.
2. The AV is certainly a possibility, but seems unlikely to only affect one particular file?
3. The controller configuration issue is something I'll ask the network supplier about, but again, why the same file?
I am going to double check that I disabled write behind caching on the individual PC.
Terry
0
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 110 total points
ID: 40483564
That can happen when one workstation is not so stable. When you kill the program instance on a workstation then files can remain locked until some timeout expires. Surely this happens when you switch the running workstation off... Then even the same workstation cannot lock the file again in the timeout period.

But how could you know if this is caused by one workstation if others do not use the file?

Previous posts clarification:
1) Locked FoxPro files are always readable by other app instances.
2) Bad antivirus can cause this behavior.
3) Also open file handle cannot affect others in shared access. If it would be exclusive file use then the error message says "File access is denied".

Each server has Shared files monitoring tool so ask your admin to look who has the file open and locked then ask the locking user what he was doing.

Shared file access on WS2008/W7 requires to turn SMB2 off on both the server and all workstations. Your admin should know how to do it.

Based on the settings FoxPro is attempting to lock the file header on every file opening. In such case the app refuses to start completely.
0
 

Author Comment

by:terrypba1
ID: 40483589
Hmm. Others do use the file, but the error has only been reported by the one user.
EXCL is set off by default on all forms, and this multi-user app has been running for 5 years, with no similar issues.
The forms update tables via local views, with buffering set to 5, Optimistic Table Buffering.
I have to admit I've never heard of SMB2. Since this has not been an issue before, I assume it's been set correctly?
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 220 total points
ID: 40483696
>Since this has not been an issue before, I assume it's been set correctly?

You talk of SMB2 here, but take that aside for the moment. Reread your own statement and see what impression it makes.

The experienced car driver has an accident and asks: "How could that happen? I drove safe for years, I can't have done anything wrong".
And even take out human error, take any object, which wears off and gets weaker over time, until it breaks.

That's true, you say, but doesn't apply to software. Software doesn't wear off, does it?

It does indeed. And not just because software always runs on hardware.

Your data grows, updating it and indexes takes longer, the time slot for SMB2 oplocks having bad effects grow and so things start happening.

Just a few weeks ago I had a case of a 100MB SQL Server table breaking RAM limitation of terminal sessions. It was from one day to the next an application failed to start. And why? Because a table grew just the few bytes too large, that broke the user session quota.

Any influence can cause something to break, even without an obvious reason like a recent software update of your own software or the OS.

So don't make any fast conclusions, the argument SMB2 was not causing conflicts for years doesn't mean it's been set correctly. If it's off, which is the correct setting to work with DBFs, then it's "set correctly", yes, and then it's obviously not the reason, but you have to look into it. And into any other possible reason. Because with the same argument nothing could have caused this and it's all merely a riddle.

If users tell me they didn't do anything, I tend to tell them, why they didn't stay at home. What they mean is, they didn't do anything unusual.

Never turn off logic.

Bye, Olaf.
0
 

Author Comment

by:terrypba1
ID: 40483732
Excellent point Olaf--I'll certainly look at the SMB2 settings.
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 220 total points
ID: 40483776
Fine, glad you liked the point, it can easily be taken the wrong way.

SMB2 is so often a first suspicion and people with such problems often don't report back. It's hard to say why. Two incidents on the same file at the same client may be an issue you don't judge as temporary flaw, but the influence of file growth also influences antivirus taking longer. Yet another reason for SMB2 but also other write conflicts leading to issues with broken files or lock errors.

The obvious way out is go SQL Server, it takes data file access into the hand of a single service instance. So no matter what you find out in the end, to prevent file problems move away from a file oriented system. I don't say the new database can't be handled with lots of recycled code and you should make the full move to something else at both database and user interface tier, but there are more and more reasons to make a move.

Bye, Olaf.
0
 

Author Comment

by:terrypba1
ID: 40483817
I'd hate to think I'm running into size issues. This particular file has 13,000 records, total size 3 meg. The form uses three other additional files, all smaller.
0
 
LVL 1

Assisted Solution

by:Rob-Nilsen
Rob-Nilsen earned 170 total points
ID: 40483932

Previous posts clarification:
 1) Locked FoxPro files are always readable by other app instances.

Yes, readable... but not lockable.  It appears the app is trying to lock a file but cannot.

The following article eludes to some of the RAID configuration stuff I referred to. Specifically, disabling read/write caching on the server drives in addition to disabling oplock.
0
 
LVL 1

Expert Comment

by:Rob-Nilsen
ID: 40483933
Oops, for got to link to the article in my last post!

Here:

http://www.tek-tips.com/viewthread.cfm?qid=657369
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:terrypba1
ID: 40483969
Thanks Rob--
Getting a list of things to check Monday, when I'll be in to check things out. Certainly disabling write caching is on my checklist setting up any PC but I'll be double checking that on this PC and the one other that makes use of this particular file.
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 220 total points
ID: 40484459
>3 meg
That's not big of course, but actually the time a table is locked for updates is critical, in that time slot bad things can happen. Your problem is even, that a lock remains, which should not remain. The root cause must be in the update not finishing normal.
An insert only appends recsize() bytes at the file end, no problem and independent of how many records you already had, an update only changes recsize bytes somewhere in the middle - both operations per record. But indexes in a cdx file may need to be reorganised by just a single update or insert, leading to really much work in the cdx file at the same time. And then antivirus chimes in and doesn't only scan the new parts of files, but the whole file. If that happens multiple times 3 meg can already disturb. What matters is concurrent users*size*time needed for virus scans and maybe more factors, really in the mathematical sense. Effects like this happen far before the 2GB limit.

Bye, Olaf.
0
 
LVL 41

Assisted Solution

by:pcelba
pcelba earned 110 total points
ID: 40484528
Olaf, I must just repeat some facts:

The problem happened twice on one workstation (out of X).
And antivirus does not lock the file. (It can just block it.)

The fastest solution always is to reinstall the problematic workstation... Of course, the problem can sit between the keyboard and a chair.
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 220 total points
ID: 40484597
I have terry. Quote:
1. it has happened twice now in a week
2. This happened a few years ago and the solution was to reboot the server
3. Others do use the file, but the error has only been reported by the one user.
So you're right with 2 out of X, but not necessarily only on one station.
Even though
4.  This is a file that is only updated by one user on a 20 user system

Anyway, Somewhere else I pointed to how antivirus software can hook into file operations on a very low level and I believe Rob Nilson as he said "Antivirus programs can interfere with FoxPro's ability to lock a file.".

5. seems unlikely to only affect one particular file?
Well, if that particular file is handled in a particular special way, that might explain why it happened twice to this file. Why not? Antivirus today monitor file operations and act on the files, which are processed. And VFP has very special ways to lock records, for example.

Take alone VFP is no database server and still offers things like locks, which other clients have to respect and therefore detect. This has to be done in a tricky way to still allow read access. Something even less known to VFP developers, so why should AV vendors not cause problems and interference with it? The safest way to avoid AV problems is to exclude VFP file extensions or data folders from scanning.

Bye, Olaf.
0
 

Author Comment

by:terrypba1
ID: 40485564
Thanks for all the input. Looks like step one will be to swap out the PC tomorrow.
I'm checking out the server from home and don't see the option to disable caching in the device manager.
Drive is Adaptec Raid 1 SCSI Disk Device. There is no policies tab.
0
 
LVL 1

Assisted Solution

by:Rob-Nilsen
Rob-Nilsen earned 170 total points
ID: 40486842
Yes, I don't think those settings are available within Windows. I normally change the read/write cache settings for the SCSI adapter from the utility accessible during the BIOS/boot process.
0
 

Author Comment

by:terrypba1
ID: 40497933
I have swapped out the suspect workstation and am watching to see if the error recurs. (Lost 10 minutes and a few grey hairs trying to figure out the grading system here. All answers were very helpful but apparently I have to assign points to my responses as well. I'll have to try again later.)
0
 
LVL 38

Expert Comment

by:younghv
ID: 41472170
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 41472171
Does this mean some general EE cleanup?
Even when author did not confirm any solution this question contains valuable output from several experts. The deletion just means (to me) experts are not welcome at EE...

If you still think it should be deleted do it.
To show some respect to experts you could select ID: 41472099 as an answer.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 41472646
Well, especially since terrry finally wrote he wanted to assign points, but couldn't cope with the rating system, there is value in the answers here, even though it's understood you can't choose what helped most.

Bye, Olaf.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Have you ever set up your wireless router at home or in the office to find that you little pop-up bubble in the bottom right-hand corner of Windows read "IP Conflict - One of more computers on the network have been assigned the following IP address"…
This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now