问题
We are experiencing some huge issues with multi-user network file sharing on version 1803 of Windows and VFP9 SP2. Here are a few of the issues we see:
Blank records written to the database. A system will write a complete record with values in all fields, but the record is blank in the table.
Records that are written but don't appear for other users until the table is closed. If session A opens a table and adds 5 records, session B will see that the extra 5 records are there, but they will either be blank or will appear to have data from a previous record in them. Once session A closes the table, the data appears for other sessions.
Records will be appended to a table, and will end up just creating a duplicate of a previous record instead.
These all appear to be issues with caching or delayed writes of some sort.
I've seen various combinations of these problems very consistently across dozens of installations in the last couple of days. The only solution has been to have the users roll back to the previous build of Windows.
We've tried disabling oplocks on the client and server machines and verifying offline files are not enabled, but haven't found a solutions.
Has anyone else seen anything similar? Suggestions? This could be a disaster if we don't figure it out.
回答1:
So here is what we have found. The problems seem to be specifically caused by the KB4103721 update to Windows 1803. We were able to resolve the problem by removing that update as a temporary solution.
We have now found that by disabling some of the SMB caching parameters.
Open a powershell administrative prompt. (right click on the start button)
Execute the following two commands:
set-smbclientconfiguration -DirectoryCacheLifetime 0
set-smbclientconfiguration -FileInfoCacheLifetime 0
You can then run
get-smbclientconfiguration
to verify that the values are set.
回答2:
I solved this problem by locking the table and if cannot lock the table then wait until table availabe for lock. Sometimes it slowdown the process but data won't lost. the codes are here
t2 = [INSERT INTO table (fields_list_here) VALUES (fields_value_here)]
IF FLOCK() && RLOCK
&t2
UNLOCK
ELSE
do while .t.
IF not FLOCK() &&RLOCK()
WAIT WINDOW "Attempting to lock. Please wait ..." NOWAIT
IF INKEY() = 27 && The loop may be too fast you may not escape. Try putting a parameter "inkey(.1)"
WAIT WINDOW "Aborting lock operation." NOWAIT
exit
ENDIF
ELSE
&t2
UNLOCK
EXIT
ENDIF
ENDDO
ENDIF
来源:https://stackoverflow.com/questions/50418733/vfp-networking-issues-with-windows-10-1803