Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error 108: file is in use by another
Message
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00528425
Message ID:
00528447
Views:
25
Hi Doug,
I guess that the program ran from command window w/o error because there was different setting for SET REFRESH ( 0, -1 or -2).

The INSERT INTO command issues implicit lock on table header. In on error routine you can check for error # 108 and issue RETRY until it succeed.

Or you can manualy lock the header. The Sleep function can be used to pause between the lock attempts reducing network congestion. It could even make your programs to run faster because there would be less lock requests/conflicts.
DECLARE INTEGER Sleep IN Win32API INTEGER cMilliseconds

SET REPROCESS TO 1    && Try only once and wait
DO WHILE NOT RLOCK("0", "MyTable")
    =Sleep(.25 * 1000)   && .25 second - just example
    * Put here some code to prevent indefinite loop
ENDDO

INSERT INTO ...
UNLOCK RECORD 0
>We've had a problem with error 108, "file is in user by another," and I'm hoping somebody can point me in the direction of a solution. Here are the details:
>
>* we have a VFP application running as a compiled EXE (VFP 6.0/SP3) on 40-50 workstations; the server is NT4.0/SP6A, and the workstations are all NT4.0/SP6A or Windows 2000/SP2
>
>* the errors always occur on the same line of code, an INSERT INTO; this error has occurred 63 times since 1/1, and during that time this line of code has executed 350,000 times
>
>* the table being inserted into is named VEHITRAN.DBF, and it's a "vehicle transaction history" table, meaning it tracks various things we do to vehicles
>
>* VEHITRAN is only used two places: the function that includes the INSERT INTO command, which is called from many places in the application, and in an SCX where users can view the records for a selected vehicle; there is no code in the application to edit or delete records in this table
>
>* the INSERT INTO command is immediately preceded by USE VEHITRAN SHARED, which I added a few weeks ago to assure that the table is always open when the insert command runs -- this change had no effect on the error; I also added the SHARED clause to the other use of this table, even though EXCLUSIVE is always off in our applications, "just to be sure," but that made no difference either
>
>* REPROCESS is set to 5 seconds throughout our applications
>
>And now here's the weird part, which I think may be some type of clue as to what's happening ... we have a program that runs a tight loop all day monitoring the status of some tables and sending out pager emails if certain things happen. This program also calls the function that does an INSERT INTO VEHITRAN, and it does this about 300 times on a typical day. That program was running from the command window (on a development PC with VFP installed) up until last weekend, and it had never crashed with the file-in-use error. Last Friday at the end of the day, I compiled that program into an EXE and started it running from that EXE, and today (Monday), it crashed with the file-in-use error on the INSERT INTO command, just like had been happening on the workstations that run a compiled application.
>
>So this only seems to happen when running from an EXE. Does anybody know of a possible explanation for that? Or a way to prevent it from happening? It's a very simple situation, with only two lines of code in the entire application that open this table, but we've been unable to resolve it. Any suggestions would be appreciated.
>
>- Doug
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform