[GHC] #12661: Testsuite driver fails on Windows

GHC ghc-devs at haskell.org
Sat Jan 28 04:23:46 UTC 2017


#12661: Testsuite driver fails on Windows
---------------------------------+--------------------------------------
        Reporter:  bgamari       |                Owner:
            Type:  bug           |               Status:  closed
        Priority:  normal        |            Milestone:  8.2.1
       Component:  Test Suite    |              Version:  8.0.1
      Resolution:  fixed         |             Keywords:
Operating System:  Windows       |         Architecture:  x86_64 (amd64)
 Type of failure:  None/Unknown  |            Test Case:
      Blocked By:                |             Blocking:
 Related Tickets:                |  Differential Rev(s):
       Wiki Page:                |
---------------------------------+--------------------------------------

Comment (by Tamar Christina <tamar@…>):

 In [changeset:"1f366b8d15feaa05931bd2d81d8b0c5bae92f3b8/ghc"
 1f366b8d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="1f366b8d15feaa05931bd2d81d8b0c5bae92f3b8"
 Add delete retry loop. [ci skip]

 Summary:
 On Windows we have to retry the delete a couple of times.
 The reason for this is that a `FileDelete` command just marks a
 file for deletion. The file is really only removed when the last
 handle to the file is closed. Unfortunately there are a lot of
 system services that can have a file temporarily opened using a shared
 readonly lock, such as the built in AV and search indexer.

 We can't really guarantee that these are all off, so what we can do is
 whenever after a `rmtree` the folder still exists to try again and wait a
 bit.

 Based on what I've seen from the tests on CI server, is that this is
 relatively rare.
 So overall we won't be retrying a lot. If after a reasonable amount of
 time the folder is
 still locked then abort the current test by throwing an exception, this so
 it won't fail
 with an even more cryptic error.

 The issue is that these services often open a file using
 `FILE_SHARE_DELETE` permissions.
 So they can seemingly be removed, and for most intended purposes they are,
 but recreating
 the file with the same name will fail as the FS will prevent data loss.

 The MSDN docs for `DeleteFile` says:

 ```
 The DeleteFile function marks a file for deletion on close.
 Therefore, the file deletion does not occur until the last handle
 to the file is closed. Subsequent calls to CreateFile to open the
 file fail with ERROR_ACCESS_DENIED.
 ```

 Retrying seems to be a common pattern, SQLite has it in their driver
 http://www.sqlite.org/src/info/89f1848d7f

 The only way to avoid this is to run each way of a test in it's own
 folder.
 This would also have the added bonus of increased parallelism.

 Reviewers: austin, bgamari

 Reviewed By: bgamari

 Subscribers: thomie, #ghc_windows_task_force

 Differential Revision: https://phabricator.haskell.org/D2936

 GHC Trac Issues: #12661, #13162
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12661#comment:22>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list