WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WIL File Handles Left Open on a Share

 Keywords: Open File Handle Share 

Question:

I've compiled a winbatch on my Windows XP 32b laptop. The executable is located on a W2003SP2 share. When I run the executable from my XP-laptop (32b) everthing works fine. When I run the executable on my new future Laptop with Windows 7 Enterprise 64bits, the program seems to work fine. It starts and it ends. But when I check the 'Open Files' on the W2003SP2 -server, I see the following:
/WBDKA44I.DLL  Test1 Windows  0  READ
/WWWNT34I.DLL  Test1 Windows  0  READ
Why this? Can it be undone through the Winbatch?

Answer:

Interesting. If WinBatch.exe has actually shut down i.e., it is no longer listed in Taskmanager then there isn't much we can do about it. The Windows kernel handles unloading dlls once a process terminates. It may be that Windows 7 caches dlls accessed from shares to improve performance or something but that is out of the control of WinBatch.

The user needs to confirm that the WinBatch process is completely terminated and use handle.exe to determine the name of the process that is holding the handles. With these bits of information I might be able to figure it out. In the interim I will do a search for any possibly relevant MSFT information regarding handle caching . Could you provide some further details:

  1. Specify the version of WinBatch you are running.
  2. Which compiler did you use to create your exe: 32-bit or 64-bit?
  3. Could you please download and run this Handle tool: http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx.
    • Run your script that apparently leaves the file handle open. Confirm that it has terminated completely in Task Manager.
    • You must have administrative privilege to run Handle.exe - Open cmd.exe using right-click ‘Run as administrator’.
    • You run Handle by typing: "handle.exe" -a >"C:\handles.txt" This will pipe all of the results out to a file.
    • Email us the resulting handles.txt file.
  4. Please also provide the name of your compiled EXE.
  5. Which antivirus tool is installed on your Windows 7 system. I've seen client side AV cause seriously nasty locking behavior on shares. Does disabling this AV tool have any effect?
Note: Wild guess but this could be an SMB issue. SMB 2.1 (Windows 7) has a performance 'enhancement' that does opportunistic locking (oplocks) of files. However, since the user dlls are on a WIndows 2003 system the client/server connection should be using SMB 1.whatever which, I think, may have some but different oplock support. Maybe Windows 7 is trying to use opportunistic locking even with the old protocol or maybe it is something entirely different. Disable oplocks: http://support.microsoft.com/kb/296264

More: we conducted a quick test using Windows 7 and Windows 2003 by running a compiled exe launched from a Win2k3 share on a Win7 machine. The dll file handles hung around for less than a minute after the exe terminated.

User Reply:

  1. Winbatch 2012C Oct 9 2012
  2. 32-bit
  3. Attached handles.txt
  4. Anti Virus installed: Symantec Endpoint Protection Version 12.1.671.4971. I uninstalled Symantec. After the reboot there were no open/locked files after running the winbatch. I tested it 10 times. After that, I installed Symantec again on the W7 client. After the reinstallation, I ran the winbatch and again open files were left on the server. So, I think that Symantec is the cause of these open files.
  5. EXE name: DriveMappings.exe

Answer:

Thank you for confirming that your AV client seemed to cause the issue. You might check and see if the software has an update that resolves this issue. If not, you may need to tell it to ignore your drivemappings.exe file.
Article ID:   W17982
Filename:   WIL File Handles Left Open on a Share.txt
File Created: 2013:03:18:09:04:08
Last Updated: 2013:03:18:09:04:08