none
Help with file lock situation RRS feed

  • Question

  • Enviornment: 

    Microsoft(R) Windows(R) Server 2003 Enterprise x64 Edition
    OS Version:                5.2.3790 Service Pack 2 Build 3790

    We are running an ETL process on sales files have been having some odd issues with intermittent file lock issues.  We run this process on many servers without issue only a couple of servers have this issue and its random.   I see a couple of different issues unable to remove directory or permission error not at the same time.

    Question 1:  how does the OS handle copying files.  If we copy the file, it sends a succes has the file been 100% copied or did the CPU jsut add it to the Que for copying and it may be a second longer?  I'm wondering if our process is trying to copy the file based on success msg and its not yet copied.

    Question 2:  I have a directory structure with several sub directories all processing at the same time.  The entire ETL process runs in say 3 hours.   Is there a script or app that I can run against this directory structure and all sub directories to capture with time stamps what has files locked?  I would want to run it only for those 3 hours and only for files under that directory structure.

    Thanks,

     

     

    Tuesday, September 21, 2010 3:08 PM

Answers

  • First of all, as far as I know, we do not have such a tool to record the file lock information for a  specific folder in a specific time. However, you may have a try on using Process Explorer to find the process which has opened a handle on a file. This would be very helpful to find out which process is holding a file handle when the problem is produced.

    Process Explorer
    http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

    In addition, as many file access issues are caused by some third party applications, especially anti-virus software, some more steps can be performed such as:

    1. If possible, just temporary disable the anti-virus software services and tested again.
    2. Upgrade your Anti-virus software to the latest version and then test.
    3. To isolate the influence of additional software, please boot the server into a Clean Boot environment and then perform the ETL process. Does the issue goes away.
    4. If the problem continues, let us  deny the granting of opportunistic locks by setting the following registry entry to 0 on the server and then reboot to test:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
    EnableOplocks REG_DWORD 0 or 1
    Default: 1 (enabled)
    Note The EnableOplocks entry configures Windows-based servers to allow or to deny opportunistic locks on local files. These servers include workstations that share files.

    Regarding more the OpLock information, you can refer to:
    Configuring opportunistic locking in Windows
    http://support.microsoft.com/kb/296264


    Shaon Shan| TechNet Subscriber Support in forum| If you have any feedback on our support, please contact tngfb@microsoft.com
    Friday, September 24, 2010 2:08 AM
    Moderator

All replies

  • Dear Sir,

    If your application calls the CopyFile API http://msdn.microsoft.com/en-us/library/aa363851(VS.85).aspx the copy operation is finished by the time the function returns a non-zero value.

    You have to be more technical to receive help on your other questions.


    Leonardo Fagundes
    Tuesday, September 21, 2010 8:31 PM
  • First of all, as far as I know, we do not have such a tool to record the file lock information for a  specific folder in a specific time. However, you may have a try on using Process Explorer to find the process which has opened a handle on a file. This would be very helpful to find out which process is holding a file handle when the problem is produced.

    Process Explorer
    http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

    In addition, as many file access issues are caused by some third party applications, especially anti-virus software, some more steps can be performed such as:

    1. If possible, just temporary disable the anti-virus software services and tested again.
    2. Upgrade your Anti-virus software to the latest version and then test.
    3. To isolate the influence of additional software, please boot the server into a Clean Boot environment and then perform the ETL process. Does the issue goes away.
    4. If the problem continues, let us  deny the granting of opportunistic locks by setting the following registry entry to 0 on the server and then reboot to test:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
    EnableOplocks REG_DWORD 0 or 1
    Default: 1 (enabled)
    Note The EnableOplocks entry configures Windows-based servers to allow or to deny opportunistic locks on local files. These servers include workstations that share files.

    Regarding more the OpLock information, you can refer to:
    Configuring opportunistic locking in Windows
    http://support.microsoft.com/kb/296264


    Shaon Shan| TechNet Subscriber Support in forum| If you have any feedback on our support, please contact tngfb@microsoft.com
    Friday, September 24, 2010 2:08 AM
    Moderator