Reputation: 27955
I read that using SMB opportunistics locking and file caching causes data corruption in FoxPro.
How to verify that those are disabled and disable them in needed at application startup with minimal user action required?
Should VFP application check registry keys like
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\Smb1 >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\Smb2 >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\EnableOplocks >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRXSmb\Parameters\OplocksDisabled >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters\UseOpportunisticLocking >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\parameters\DirectoryCacheLifetime >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\parameters\FileInfoCacheLifetime >HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\parameters\FileNotFoundCacheLifetime
or parse powershell Set-SmbClientConfiguration or msinfo output or is there better way ?
How to set them in application startup ? Should application require registry access and wrote values to registry or invoke powershell like
Set-SmbClientConfiguration -EnableMultiChannel $false Set-SmbClientConfiguration -OplocksDisabled $True Set-SmbClientConfiguration -UseOpportunisticLocking $False
or powershell script like
`$Name1 = “DirectoryCacheLifetime” $Name2 = “FileInfoCacheLifetime” $Name3 = “FileNotFoundCacheLifetime” $value = “0” New-ItemProperty -Path $registryPath -Name $name1 -Value $value -PropertyType DWORD -Force | Out-Null New-ItemProperty -Path $registryPath -Name $name2 -Value $value -PropertyType DWORD -Force | Out-Null New-ItemProperty -Path $registryPath -Name $name3 -Value $value -PropertyType DWORD -Force | Out-Null`
Using Visual FoxPro 9 , mostly in Windows 10
Answer in
VFP networking issues with Windows 10 1803
described how to do this manually but I'm looking for automatic solution which requires minimal user interaction.
Upvotes: 1
Views: 4506
Reputation: 4288
That is incorrect in the sense that it's not an across-the-board thing.
At certain times over the years, depending on what fiddling Microsoft is doing with the SMB protocol, file-based databases like Visual FoxPro DBFs and Microsoft Access have encountered corruption of one sort or another.
This is by no means something that happens across the board, therefore a blanket solution to be rolled out on every site is overkill IMO. I would apply these types of changes on a per-site basis as they can affect performance.
The EnableOplocks\OplocksDisabled settings were to do with an index file corruption issue maybe 10 years ago. You cannot turn them off on SMB2 and SMB3, basically Windows 8 and above connecting to Server 2012 or above.
The DirectoryCacheLifetime\FileInfoCacheLifetime\FileNotFoundCacheLifetime adjustments have recently become necessary on some installations that are on Windows 10 1803 and have as a result had whatever changes Microsoft made to SMB installed. The problems mainly manifest themselves in Visual FoxPro as delays in updates to DBF files becoming visible to all users. There are also similar issues in Microsoft Access.
Since the caching changes can sometimes affect application performance quite badly, I would only apply them where necessary.
Upvotes: 1
Reputation: 4288
That is incorrect in the sense that it's not an across-the-board thing.
At certain times over the years, depending on what fiddling Microsoft is doing with the SMB protocol, applications using file-based databases like Visual FoxPro DBFs and Microsoft Access have encountered corruption of one sort or another, for some users, on some workstations.
This is by no means something that happens across the board, therefore a blanket solution to be rolled out on every site is overkill IMO. I would apply these types of changes on a per-site basis as they can affect performance.
The EnableOplocks\OplocksDisabled settings were to do with an index file corruption issue maybe 10 years ago. You cannot turn them off on SMB2 and SMB3, basically Windows 8 and above connecting to Server 2012 or above.
The DirectoryCacheLifetime\FileInfoCacheLifetime\FileNotFoundCacheLifetime adjustments have recently become necessary on some installations that are on Windows 10 1803 and have as a result had whatever changes Microsoft made to SMB. The problems mainly manifest themselves in Visual FoxPro as delays in updates to DBF files becoming visible to all users. There are also similar issues in Microsoft Access.
Since the caching changes can sometimes affect application performance quite badly, I would only apply them where necessary.
Upvotes: 0
Reputation: 89
AIUI recent versions of windows use SMB3 which overrides/ignores these settings.
And following a virus scare (about 18 months ago i think - sorry don't remember the details) the recommendation is to NOT switch off SMB3.
Which leaves networked DBFs vulnerable and performance slow.
LOCK and FLUSH will help but now would be a good time to rewrite all data access to use a SQLExpress or MariaDB server instead.
Upvotes: -1