Skip to content

Seems hard to believe, but do multiple test cases share files? #98372

Description

@smontanaro

Bug report

I got a failure on a pull request with this error message on the Windows x64 job:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\\a\\cpython\\cpython\\build\\test_python_4912�\\test_python_worker_4268�'

I know Windows will complain if two processes try to open the same file, but should different test cases even be using the same (temporary?) files? If they are, you'd think eventually test runs on other platforms would experience problems (stomping on each others' private data, for instance).

Unfortunately, I went back only to find GitHub had elided most of the steps, including that one.

Your environment

GitHub standard CI environment

Activity

  1. eryksun commented on Oct 17, 2022

    @eryksun
    Contributor

    See issue #98219.

    I know Windows will complain if two processes try to open the same file

    It's not inherently related to processes. A filesystem manages a share-access record for each open file or directory, which tracks the number of current opens that have read, write, or delete access, as well as the number of current opens that share read, write, and delete access. The tracking is only per open file object in the kernel. Access sharing is updated and checked whenever a file or directory is opened. It has nothing inherently to do with processes, despite the misleading error message for ERROR_SHARING_VIOLATION (32). On the other hand, a file lock (i.e. a read/write lock of a byte range in a file) is associated with a process. The error code for a locking violation is ERROR_LOCKING_VIOLATION (33). A locking violation can occur even if an open has the requisite read or write access since byte-range locks are enforced at the time of access, not at the time a file is opened.

  2. arhadthedev commented on Oct 18, 2022

    @arhadthedev
    Member

    The bug is currently investigated and fixed for Windows 11 in gh-97641. It looks like the fix will remedy the GitHub Actions too.

  3. erlend-aasland commented on Oct 18, 2022

    @erlend-aasland
    Contributor

    The bug is currently investigated and fixed for Windows 11 in gh-97641. It looks like the fix will remedy the GitHub Actions too.

    Which fix? Is there a PR?

  4. erlend-aasland commented on Jan 15, 2024

    @erlend-aasland
    Contributor

    Is there an actionable item here? This issue has been stale since Oct 2022; suggesting to close it.

  5. added
    pendingThe issue will be closed if no feedback is provided
    on Jan 15, 2024
  6. smontanaro commented on Jan 15, 2024

    @smontanaro
    ContributorAuthor

    Wouldn't appear so. Close it...

  7. removed
    pendingThe issue will be closed if no feedback is provided
    on Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions