Jump to content

Win 2k3 R2: access the list of opened files to track down bad program hangs?


Recommended Posts

Hi.

Who knows how to directly read out the information displayed in Computer Management, System, Shared Folders, Opened Files?

I suspect that e.g. a file lock which isn't released might be the cause, so I want to followup all the changes in the opened file's list using an Autoit program: Howto access that list of the opened files directly?

Any suggestions appreciated, also ideas for any different approaches to catch the cause of such program hangs,

Rudi.

--

This is our trouble:

With an Windows 2003 R2 server there is a problem with an application, that is hanging from time to time very badly. In this state the (Delphi) Program first doesn't update it's output screens, after maybe 15 seconds in TaskManager it's shifting to the state "not responding", and after some while (may be 5 mins and more) it will continue suddenly without any problems.

That program uses Paradox DBs. That program is used in several other locations (other end customers) as well without any trouble. Our site is with 15 concurrent users in the mid range of all the customers using that program. 10 Users are using LAN access, 5 are using TSClient. RAM is 4 Gig, 3.6 available to the system, no Disk Swapping at all. (So RAM is sufficent)

CPU Usage is not going up if the program is hanging (1 to 5 % CPU load with ~20% peaks is typical)

The programmer is also involved in our tries to track down that issue. So now he is using a file history.deb to log, what's going on (login / logout to that program, all data modifications, with timestamp, user and hostname).

Just right now I tried to copy that file to the folder c:\temp\, it's some 6MB in size, and that copy hanged as well for about 30 seconds. Nothing in the eventlogs of Win2k3. Further copy actions now are very fast again (Proliant ML 350 with SmartArray HW-RAID 1 SAS disk system)

This issue also disappeares immediately, when all running instances of that program are closed at the same time, and then started again.

Disableing the AV-Scanner (Sophos Antivirus) doesn't change anything.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Try the following tools from Sysinternals.com: Process Explorer, Process Monitor, Handle, PSFile

and OpenedFilesView from Nirsoft.net

Thanks for your reply.

AFAIK these tools cannot be used from other (autoit) programs to get the results back into the calling program directly, right?

So again my question if somebody knows, how to retrieve that infomation directly (DLL call or whatsoever) ??

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Well PSFile and Handle are command line tools so you could read the STDOut and parse the info.

OpenedFilesView accepts command line parameters for exporting results and closing handles. link

Edited by ZoSTeR
Link to comment
Share on other sites

Well PSFile and Handle are command line tools so you could read the STDOut and parse the info.

That's what I wanted to avoid. I'd like to pull the information very frequently and so I expected, that the fastest (least CPU intensive) way would be a direct info retrieve from the OS' APIs...

OpenedFilesView accepts command line parameters for exporting results and closing handles. link

Thanks, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

there is and udf for that ...

_net_share_fileenum.

#include <GuiConstantsEx.au3>
#include <NetShare.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $sServer, $aInfo

   ; Create GUI
    $hGUI = GUICreate("NetShare", 400, 300)

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

   ; Get server and share information
    $sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
    If @error Then Exit

   ; Enumerate open files on the server
    $aInfo = _Net_Share_FileEnum ($sServer)
    MemoWrite("Error ...................: " & @error)
    MemoWrite("Entries read ............: " & $aInfo[0][0])
    For $iI = 1 To $aInfo[0][0]
        MemoWrite("Resource ID .............: " & $aInfo[$iI][0])
        MemoWrite("Resource permissions ....: " & _Net_Share_PermStr ($aInfo[$iI][1]))
        MemoWrite("Resource locks ..........: " & $aInfo[$iI][2])
        MemoWrite("Resource path ...........: " & $aInfo[$iI][3])
        MemoWrite("Resource user ...........: " & $aInfo[$iI][4])
        MemoWrite()
    Next

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc  ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc  ;==>MemoWrite

look in the help file.

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...