Menu

Staf exception was thrown while deleting directory on our VM machine

Help
Aneesh
2016-10-06
2016-11-17
  • Aneesh

    Aneesh - 2016-10-06

    What might be the reasons for that exception even though the file is present at correct path as specified.This is a Selinium-Grid job and was obeserved when it was terminated due to the same reason.

    -Aneesh.

     

    Last edit: Aneesh 2016-10-06
  • Sharon Lucas

    Sharon Lucas - 2016-10-06

    Please provide more information.

    1. What was the exact STAF request you specified? (A STAF FS DELETE request?)
    2. What was the complete exception message?
     
  • Aneesh

    Aneesh - 2016-10-06

    Yes, my request is STAF LOCAL FS DELETE ENTRY filename RECURSE CONFIRM

    Exception message:
    Unhandled "Exception" condition found at end of job.
    Source: throw: FrameworkException.DirectoryFailed
    Info: Machine: local
    RC: 20
    Request: DELETE ENTRY C:(path) RECURSE CONFIRM
    STAFResult: [{'staf-map-class-name': u'STAF/Service/FS/ErrorInfo', u'osRC': u'32', u'rc': u'10', u'name': u'C:\(path)\bin\Drivers\IEDriver\IEDriverServer.exe'},{'staf-map-class-name': u'STAF/Service/FS/ErrorInfo', u'osRC': None, u'rc': u'50', u'name': u'C:\(path)\bin\Drivers\IEDriver'},....]

     
  • Sharon Lucas

    Sharon Lucas - 2016-10-06

    The STAFResult shows that the FS DELETE directory request failed with STAF return code 50 (Directory Not Empty) because it got operating system return code (osRC) 32 when trying to delete file C:(path)\bin\Drivers\IEDriver\IEDriverServer.exe. You can use a "net helpmsg" command on Windows to get more information about Windows error codes (or google it):

    C:\>net helpmsg 32
    
    The process cannot access the file because it is being used by another process.
    

    Note: Sub-section "8.5.13 DELETE" in section "8.5 File System (FS) Service" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRFSSRV says:

    If errors were encountered deleting entries and IGNOREERRORS was not specified, the result buffer will contain a marshalled <List> of <Map:STAF/Service/FS/ErrorInfo> representing a list of error information about the entries that were not successfully deleted.

    For the definition of the FS/ErrorInfo map class, see "Table 15. Definition of map class STAF/Service/FS/ErrorInfo" at http://staf.sourceforge.net/current/STAFUG.htm#TBLFSERRORINFOTABLE.

     
    • Aneesh

      Aneesh - 2016-11-10

      How to force delete the file that is being used by another process, as this is the only way to handle my exception.

       
    • Aneesh

      Aneesh - 2016-11-17

      So, how to know which process is using that perticular file so that it can be kill and continue the operation with that file. Tried googleing for the solution, but no luck.

       
  • Aneesh

    Aneesh - 2016-11-10

    .

     

    Last edit: Aneesh 2016-11-10
  • Sharon Lucas

    Sharon Lucas - 2016-11-10

    The STAF FS service's DELETE request cannot force the deletion of a file that is in use by another process.

    You can google for ways to force the deletion of a file that is in use on Windows. For example, at https://www.sitepoint.com/web-foundations/force-windows-delete-file/, it talks about using the Windows del command with the /f (force) option to force the deletion of a file. For example: ‘del /f filename’. You could run this command via a <process> element in your STAX job.

    You can get the name of the locked file from the STAFResult set by the <stafcmd> performing the FS DELETE request.

     

Log in to post a comment.