Web Connection
Server 2012 suddenly locking files
Gravatar is a globally recognized avatar based on your email address. Server 2012 suddenly locking files
  Geoff Bannoff
  All
  Oct 29, 2019 @ 11:49am

Hi there

The application that I'm supporting on Windows Server 2012 is suddenly locking files about 45 minutes after a reboot. This seemed to start yesterday.

My application (450 screens, 110 users) opens tables then closes them at the end of every hit.

The application has been running fine for years. Maybe a Windows update?

I'm watching Computer management > Shared folders > Open files, and everything works just fine. Then the file locks start stacking up and all the various user screens start showing error messages.

I'm lost. Any suggestions?

.. Geoff Bannoff Vancouver, Canada

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Geoff Bannoff
  Geoff Bannoff
  Oct 29, 2019 @ 11:53am

When a file is locked, attemping to open the file from VFP on my computer on the network fails. I get a "file is in use" error in VFP.

I'm seeing maybe 20-30 files with locks.

.. Geoff

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Rick Strahl
  Geoff Bannoff
  Oct 29, 2019 @ 12:25pm

Hard to say without a lot more investigation.

First - I would check and make sure nothing has changed in the app. Could it be that maybe somehow, somewhere a file is being opened exclusively and not getting closed?

The other issue might be Windows and SMB issues with network access. Do a search and you get a ton of information on that issue - network access for FoxPro files can be problematic due to this issue.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Geoff Bannoff
  Rick Strahl
  Oct 29, 2019 @ 05:29pm

Hi Rick

We got another server running and pointed it at the file share on the 2012 server, and everything works just fine.

It appears to be a problem inside IIS.

This application has 25,000 hits a day. No updates to the application for the last month or so. Every hit is designed to open tables, do some work, then close all tables. No table should be open for more than a fraction of a second. There are about 120 tables--and they have been working well for decades.

Late yesterday, file locks started piling up, causing a lockout of several tables.

Manually releasing the file locks (Computer management > Shared folders > Open files > Close all open files) fixed everything for 30-45 minutes, and then the problem started again. IISRESETs and reboots solved the problem for 45 minutes to an hour before it started again.

Moving the IIS processing to a new, but not fully tested, Windows 2016 Server, pointing to the data on the 2012 server, got the company going.

Quite the day. This is why I retired from programming a couple of years ago.

.. Geoff

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Rick Strahl
  Geoff Bannoff
  Oct 29, 2019 @ 05:48pm

Make sure the account IIS (and your application if you're explictly setting DCOM Config Identity) are correct. Make sure the account you're using has all the rights it needs to read/write/create files in the target folder. Also make sure that the account has rights to write temporary files in Windows (that should always be the case but could be an issue).

Also make sure you're not using request impersonating (an IIS Legacy feature) - if you do you might be jumping to different impersonations in requests that might be changing your permissions.

Easiest way to check this have your error handler (you do have one right?) write out Windows account information so you know what user is doing the writing.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Geoff Bannoff
  Geoff Bannoff
  Oct 29, 2019 @ 09:24pm

Thanks for the suggestions, Rick. Everything is set correctly--it's been checked and double-checked. And most of the 25,000 queries are going through properly.

However, it's the transactions that are suddenly failing. I only use free tables. Pretty well everything that updates multiple tables is wrapped in a transaction. And it strikes me that it's only those tables where the locks are piling up.

Odd... it's all working properly when the same .exe is run from a different server. But when the data is being accessed locally using a share some (but not all) of the transactions are not getting committed, and the locks are sticking.

I bet it's some odd Windows update for Server 2012.

.. Geoff

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Rick Strahl
  Geoff Bannoff
  Oct 30, 2019 @ 12:25am

Again it's possible it's network settings. I would still perhaps suspect the SMB protocol here, just because it seems so intermittent.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Geoff Bannoff
  Rick Strahl
  Oct 30, 2019 @ 06:18pm

Hi Rick

Thanks for that advice. It turned out that the Windows Server 2012 only had SMB1 active. We had turned off SMB2/3 years ago because it was still occasionally being accessed by Windows 7 and Server 2008 machines. We never turned SMB2/3 back on when those machines got upgraded to new operating systems.

We turned on SMB 2/3 this morning on the Server 2012. No problems today.

Maybe SMB 1 couldn't handle the rapid-fire locks/unlocks that happen in a complex transaction. Still, it's odd that problems only started yesterday after years of working correctly.

At any rate, today's 25,000 hits all worked, so we are happy.

.. Geoff

Gravatar is a globally recognized avatar based on your email address. re: Server 2012 suddenly locking files
  Rick Strahl
  Geoff Bannoff
  Oct 31, 2019 @ 01:31pm

Glad that's all it was - lots of people running into issues with SMB versions, so this is not new. Defaults are OK usually, but if settings get messed it often becomes a problem.

+++ Rick ---

© 1996-2024